cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2589
Views
0
Helpful
3
Replies

Issue with Cisco solicited IOS CLI commands

vanoordtm
Level 1
Level 1

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.

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

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

action 1.8 cli command "y"

View solution in original post

3 Replies 3

Joe Clarke
Cisco Employee
Cisco Employee

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

action 1.8 cli command "y"

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

You should see whatever IOS typically prints out.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: