Useful Cisco EEM Scripts

Following are two very useful EEM script, I talk about two features in EEM through these scripts.

1- Watchdog timer: This feature is particularly useful when you need to run a script for in periodic interval. For example below EEM script runs in every 100 sec and flap the bgp neighbor.

event manager applet TEST
event timer watchdog time 100
action 1.0 syslog msg "EEM Triggered"
action 1.1 cli command "enable"
action 1.2 cli command "conf t"
action 1.3 cli command "router bgp 100 "
action 1.4 cli command "neigh 50.50.50.2 shut"
action 1.5 cli command "no neigh 50.50.50.2 shut"
action 1.6 cli command "end"

 

2- In few cases we know that we see cisco IOS asking for confirmation before executing the command, for example in below script I want to do a switchover on the router(SSO).But before this router asks for the permission to confirm the switchover, so clearly it is two step process just putting the redundancy switchover command will not help, in these cases we need to use “pattern” keyword to capture the confirmation and then put the command “Y” or “N” as per our need.

event manager applet TEST
event timer watchdog time 2700
action 1.0 syslog msg "EEM Triggered"
action 1.1 cli command "enable"
action 1.2 cli command "redundan force-swi" pattern "confirm"
action 1.3 cli command "y"

 

Stay tuned for more posts like this.Thanks for reading.

 

 

 

 

 

 

 

Advertisements

Leave a Reply