Re-enable debugs on router reload – EEM Script

Gateways Router

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.

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

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.

  1. By issuing the command “reload” to restart the router.
  2. 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.

Re-enable debugs on router reload – EEM Script was last modified: March 12th, 2018 by Administrator
(Visited 105 times, 1 visits today)

Leave a Reply