cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1737
Views
0
Helpful
3
Replies

EEM TCL - disable/re-enable syslog detector

Jon Berres
Level 4
Level 4

Hello,

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.

Thanks,

Jon

3 Replies 3

Joe Clarke
Cisco Employee
Cisco Employee

Unregister and reregister is likely the easiest thing to do.  However, you could also use the mutex trick posted at

https://supportforums.cisco.com/docs/DOC-24600 as a way to check if another instance of the policy is running, then exit if so.

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

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.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: