05-20-2009 11:26 AM
Hello, I have this EEM script
event manager applet TEST
event syslog pattern "changed state to up"
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "ip route 172.16.1.1 255.255.255.255 10.1.1.1"
action 3.5 cli command "exit"
action 3.7 cli command "exit
It stops at "config t" and does not continue. When I configure it for "event none" to test it manually, it works.
Any ideas? Thanks
05-20-2009 11:52 AM
Don't do exit twice. Use end instead:
action 3.5 cli command "end"
As for why it stops at the config t prompt, I suspect AAA. Please post the output of "debug event manager action cli" along with the show run and show ver from this device.
05-20-2009 12:14 PM
I have tried using end as well as without exit commands. When I test manually with event none it works. I don't have AAA configured on it.
Here is the debug:
*Mar 1 02:12:19.119: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up
*Mar 1 02:12:19.215: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : CTL : cli_open called.
*Mar 1 02:12:19.219: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : IN :
*Mar 1 02:12:19.351: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT :
*Mar 1 02:12:19.355: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : C>
*Mar 1 02:12:19.355: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : C>
*Mar 1 02:12:19.359: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : C>
*Mar 1 02:12:19.359: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : IN : C>enable
*Mar 1 02:12:19.487: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT :
*Mar 1 02:12:19.491: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : C#
C#
*Mar 1 02:12:19.495: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : IN : #config t
C#
----
C#sho run | ex !
Building configuration...
Current configuration : 1323 bytes
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
hostname C
boot-start-marker
boot-end-marker
logging buffered 16384 debugging
no aaa new-model
memory-size iomem 5
ip cef
no ip domain lookup
interface FastEthernet0/0
no ip address
shutdown
duplex auto
speed auto
interface Serial1/0
ip address 10.1.1.2 255.255.255.252
serial restart-delay 0
interface Serial1/1
ip address 10.1.1.5 255.255.255.252
serial restart-delay 0
interface Serial1/2
no ip address
shutdown
serial restart-delay 0
interface Serial1/3
no ip address
shutdown
serial restart-delay 0
router eigrp 50
network 10.1.1.2 0.0.0.0
network 10.1.1.5 0.0.0.0
no auto-summary
ip http server
ip forward-protocol nd
control-plane
gatekeeper
shutdown
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
no login
line vty 5 871
no login
event manager applet TEST
event syslog pattern "changed state to up"
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "ip route 172.16.1.1 255.255.255.255 10.1.1.1"
action 3.5 cli command "exit"
action 3.7 cli command "exit"
action 4.0 syslog msg "Route Added"
end
---
IOS is c3640-jsx-mz.124-23.bin
05-20-2009 12:19 PM
BTW, It works sometimes (maybe 1 out 5) and the other times it just stops at config t.
05-20-2009 01:06 PM
I don't see any errors here. I put your policy on a 3660 running 12.4(23) with your config, and I get consistent execution every time. One thing I did notice, though, is that your pattern is a bit too lax. It will match %LINEPROTO-5-UPDOWN and %LINK-3-UPDOWN messages. Perhaps you want to do something like:
event syslog pattern "LINEPROTO-5-UPDOWN.*changed state to up"
The fact that you're seeing intermittent success makes me think there is some kind of race condition.
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: