Re-enable debugs on router reload – EEM Script
Originally posted on February 15, 2022 @ 8:55 pm
Re-Enable Debugs on Router Reload using EEM Script
I was recently troubleshooting one issue and i ran some debugs on Cisco Voice Gateway and wrote the config by issuing the command “write memory”. Since the router received high call volume, the CPU spiked and the router was reloaded. Upon router reload, the debugs were turned off automatically.
Upon investigation, i realized that this is the expected behavior and to overcome such scenario there is a way by configuring EEM (Embedded Event Manager). EEM scripts can be configured in Cisco IOS, XR, and NX-OS. EEM scripts can be configured in such a way that when an event is triggered, you can run some certain set of commands which are defined in EEM Script.
EEM Configuration:
To achieve the required scenario, i configured the following in the router:
Router#enable
Router(config)# event manager applet EnableDebuggingAfterReload
Router(config-applet)# event syslog occurs 1 pattern “%SYS-5-RESTART”
Router(config-applet)# action 1.0 cli command “enable”
Router(config-applet)# action 2.0 cli command “debug ccsip error”
Router(config-applet)# action 3.0 cli command “debug ccsip non-call”
Router(config-applet)# action 4.0 cli command “debug ccsip messages”
Router(config-applet)# exit
Router(config)# exit
Router(config)# write memory
EEM Testing:
To test the EEM script, i reloaded the router by issuing the command “reload” and also by powering the router down and bringing it back again. In both
I used two different testing scenarios to verify if the EEM script is working as expected.
- By issuing the command “reload” to restart the router.
- By hard powering down the router and start the router manually.
Note: It is always recommended to run such debugs during a maintenance window and off business hours as running such debugs can bring the network down.
I am working in an IT company and having 10+ years of experience into Cisco IP Telephony and Contact Center. I have worked on products like CUCM, CUC, UCCX, CME/CUE, IM&P, Voice Gateways, VG224, Gatekeepers, Attendant Console, Expressway, Mediasense, Asterisk, Microsoft Teams, Zoom etc. I am not an expert but i keep exploring whenever and wherever i can and share whatever i know. You can visit my LinkedIn profile by clicking on the icon below.
“Everyone you will ever meet knows something you don’t.” ― Bill Nye