My First EEM Applet Script
Cisco IOS Embedded Event Manager (EEM) is a powerful tool integrated with Cisco IOS Software for system management from within the device itself. EEM offers the ability to monitor events and take informational, corrective, or any desired action when the monitored events occur or when a threshold is reached. Capturing the state of the router during such situations can be invaluable in taking immediate recovery actions and gathering information to perform root-cause analysis. Network availability is also improved if automatic recovery actions are performed without the need to fully reboot the routing device.
Ok let try to Prevent someone turning off Loopback Zero!
The Script:
event manager applet Lo0 event syslog occurs 2 pattern "Loopback0, changed state to admin" action 1.0 syslog msg "Hey Someone shutdown my loopback0 - Turning it back on" action 1.1 syslog msg "I am a Smart Router, i will turn my lo0 back up again" action 1.2 cli command "enable" action 1.3 cli command "configure ter" action 1.4 cli command "int lo0" action 1.5 cli command "no shut" action 1.6 syslog msg "OK should be back up again"
Thanks to The Cisco Learning Network for this tip!
![]()
Nice one, however, there is a small issue! Loopback0 will change state to “admin down” even if it was deleted with “no interface loopback0″. Your script will in fact recreate the interface, but with no configuration. Perhaps you can add few more commands to fix that
Hello Marko!!
Thanks for the catch there, and now with this script that issue should be fixed
Cheers!
Victor.-
If I may sugggest a more robust pattern match?
event syslog occurs 2 pattern “Loopback0.*down”
Hi,
if you don’t exit the eem in the end you can finish vty lines:
*Mar 1 01:23:30.055: %HA_EM-3-FMPD_CLI_CONNECT: Unable to establish CLI session: no tty lines available, minimum of 2 required by EEM
R#sh users
Line User Host(s) Idle Location
* 0 con 0 idle 00:00:00
98 vty 0 idle 00:14:15 EEM:L0
99 vty 1 idle 00:05:24 EEM:L0
100 vty 2 idle 00:04:13 EEM:L0
Just add “end” and “exit” at the end of the script:
action 6.0 cli command “end”
action 7.0 cli command “exit”
HTH
Thank you good to know!!
[...] http://anetworkerblog.com/2009/10/03/my-first-eem-applet-script/ Dit bericht is geplaatst in Cisco Tips. Bookmark de permalink. ← Synology: Symbolic Links [...]