Cisco Support Community
Community Member

EEM TCL - disable/re-enable syslog detector


I have a question concerning the syslog detector for an EEM script using TCL. Sorry if this is already covered somewhere else I could not find relevent info with a search. I have a TCL script which kicks off if a T1 flaps because of LOS (syslog message = controller t1 0/0*LOS) and then issue a shut/no shut. The problem is that this can create a loop if the LOS is still remaining after bouncing the T1. Multiple instances of the script can end up being run on top of one another until I disable the EEM and re-register.

I am wondering if there is an easy way to disable the syslog detector while the script is running so it will ignore any LOS syslogs until the script is finished. I have a work around where I remove the "event manager policy" command before flapping the interface and then re-registering the policy at the end. However, it seems like a poor work around to de-register the entire policy. I also tried using a global variable and set it from 0 to 1 when the script was in progress. However, the  subsequent script instances did not seem to grab the new global variable value until the first instance was complete and the variable was set back to 0. So that did not work.

Any ideas are appreciated.



Everyone's tags (4)
Cisco Employee

EEM TCL - disable/re-enable syslog detector

Unregister and reregister is likely the easiest thing to do.  However, you could also use the mutex trick posted at as a way to check if another instance of the policy is running, then exit if so.

Community Member

EEM TCL - disable/re-enable syslog detector

Thanks for the suggestion. I tried using that mutex method of checking for 2 instances of a policy running. It appears that while the 2nd syslog gets triggered by the first instance is running the 2nd instance doesn't start until the first is completed. So basically the script continuted to loop. I will stick to unregistering the policy while I flap the interface to avoid the loop.

thanks again

Cisco Employee

EEM TCL - disable/re-enable syslog detector

You would need to modify the mutex to call "exit 0" if you find another instance running.  You will also need to increase your Tcl thread count to at least 2 using "event manager scheduler script thread class default number 2".  But the unregister/register might be an easier way to go if you can accept the config churn.

CreatePlease to create content