Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

Issue with Cisco solicited IOS CLI commands

So I'm trying to reload the router with EEM.  However, I want it done via cli action statement, so I can delay the reload in 10.  However, I'm having issues with the pattern keyword.  Below is my applet and the debug.  It seems the pattern statement is not answering the solicited question.  I've tried several different combinations, but the one below makes the most sense to me.

event manager applet TEST

event none

action 1.0 syslog msg "Reload Router"

action 1.1 cli command "enable"

action 1.3 cli command "reload in 10" pattern "yes"

action 1.5 cli command "confirm"

action 1.7 syslog msg "It worked!!!"

*Mar  1 00:37:18.831: %HA_EM-6-LOG: TEST: Reload Router

*Mar  1 00:37:18.839: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : CTL : cli_open called.

*Mar  1 00:37:18.939: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT :

*Mar  1 00:37:18.939: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : R2>

*Mar  1 00:37:18.939: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : IN  : R2>enable

*Mar  1 00:37:18.955: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT :

*Mar  1 00:37:18.955: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : R2#

*Mar  1 00:37:18.955: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : IN  : R2#reload in 10

*Mar  1 00:37:18.967: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : IN  : confirm

R2#

R2#

*Mar  1 00:37:38.879: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT :

*Mar  1 00:37:38.879: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : % Please answer 'yes' or 'no'.

*Mar  1 00:37:38.879: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT :

*Mar  1 00:37:38.879: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : System configuration has been modified. Save? [yes/no]:

*Mar  1 00:37:38.879: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : CTL : cli_close called.

The Manual Way:

R2#reload in 10

System configuration has been modified. Save? [yes/no]: yes
Building configuration...
[OK]
Reload scheduled in 10 minutes by console
Reload reason: Reload Command
Proceed with reload? [confirm]
R2#
*Mar  1 00:56:27.083: %SYS-5-SCHEDULED_RELOAD: Reload requested for 01:06:22 UTC Fri Mar 1 2002 at 00:56:22 UTC Fri Mar 1 2002 by console. Reload Reason: Reload Command.

I even tried this:

event manager applet TEST
event none
action 1.0 syslog msg "Reload Router"
action 1.1 cli command "enable"
action 1.2 cli command "wr"
action 1.3 cli command "reload in 10" pattern "confirm"
action 1.7 syslog msg "It worked!!!"
!
end

R2#
R2#
R2#event manager run TEST

*Mar  1 00:54:52.855: %HA_EM-6-LOG: TEST: Reload Router
R2#
*Mar  1 00:54:52.863: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : CTL : cli_open called.
*Mar  1 00:54:52.963: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT :
*Mar  1 00:54:52.963: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : R2>
*Mar  1 00:54:52.963: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : IN  : R2>enable
*Mar  1 00:54:52.979: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT :
*Mar  1 00:54:52.979: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : R2#
*Mar  1 00:54:52.979: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : IN  : R2#wr
*Mar  1 00:54:53.895: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT :
*Mar  1 00:54:53.899: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : Building configuration...
*Mar  1 00:54:53.899: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : [OK]
*Mar  1 00:54:53.899: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : R2#
*Mar  1 00:54:53.903: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : IN  : R2#reload in 10
*Mar  1 00:54:54.015: %HA_EM-6-LOG: TEST: It worked!!!
R2#
*Mar  1 00:54:54.015: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : CTL : cli_close called.

Everyone's tags (3)
1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

Issue with Cisco solicited IOS CLI commands

Your second approach is good, but you're not answering the prompt.  Add:

action 1.8 cli command "y"

3 REPLIES
Cisco Employee

Issue with Cisco solicited IOS CLI commands

Your second approach is good, but you're not answering the prompt.  Add:

action 1.8 cli command "y"

New Member

Issue with Cisco solicited IOS CLI commands

Should I expect the debug to print the Pattern response??

Cisco Employee

Issue with Cisco solicited IOS CLI commands

You should see whatever IOS typically prints out.

1018
Views
0
Helpful
3
Replies