EEM TCL - disable/re-enable syslog detector

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

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

Similar Messages

  • Help with EEM TCL / CLI scripting for re-direction/wccp counters

    Being new with EEM scripting I wanted to see if I was on the right track and get some help to finish my idea.
    Our problem I am trying to fix is our remote sites utilize pairs of Cat3650's for some routing and WCCP redirection.  We are encountering ACL denial issues causing slow down and access issues.  The fix for the issue we remove the WCCP service groups to break peering with our wan optimizers and re-insert the configuration thus re-establishing peering and restoring service.
    My idea is to use a TCL scipt on a watchdog timer to parse the "sh ip wccp | inc denied (or unassign)" output for denial and unassignable error counters.  If a counter is found I wanted to create a syslog message that would then kick off a simple EEM CLI script to remove the service groups, wait 10 seconds, then re-add the service groups.  Please point me in the right direction if I am off track as I am not sure if I can use the EEM CLI for all this or since I want to retreive specific info from the sh ip wccp output if I do need to utilize TCL.  I am also unsure if the "total denied" ascii string pulled via the "sh ip wccp | inc denied" will cause issues when attempting to just pull the counter information.
    sh ip wccp | inc Denied Red
            Total Packets Denied Redirect:       0
            Total Packets Denied Redirect:       0
    Script thus far :
    TCL
    if [catch {context_retrieve "EEM_WCCP_ERROR_COUNTER" "count"} result] {
    set wccpcounter 0
    } else {
    set wccpcounter $result
    } if [catch {cli_open} result] {
    error $result
    } else {
    array set cli $result
    } if [catch {cli_exec $cli(fd) "show ip wccp | incl Denied"} result] {
    error $result
    } else {
    set cmd_output $result
    set count ""
    catch [regexp {receive ([0-9]+),} $cmd_output} ignore count]
    set count
    set diff [expr $count - $wccpcounter]
    if {$diff != 0} {
    action_syslog priority emergencies msg "WCCP counters showing incremental Denied packet counts"
    if [catch {cli_close $cli(fd) $cli(tty_id)} result] {
    error $result
    context_save EEM_WCCP_ERROR_COUNTER count
    CLI
    event manager applet WCCP_COUNTER_WATCH
    event syslog priority emergencies pattern "WCCP counters showing incremental Denied packet counts"
    action 001 cli command "enable"
    action 002 cli command "config t"
    action 003 cli command "no ip wccp 61"
    action 004 cli command "no ip wccp 62"
    action 005 wait 10
    action 006 cli command "ip wccp 61"
    action 007 cli command "ip wccp 62"
    action 008 wait 15
    action 009 cli command "clear ip wccp"
    action 010 cli command "end"
    Thanks for all the help

    This won't work as EEM cannot intercept its own syslog messages.  However, I'm not sure why you need this form of IPC anyway.  Why not just make the Tcl script perform the needed CLI commands?
    And, yes, you could use all applets here.  But since you've written the hard stuff in Tcl already, it might be best just to add the missing calls to reconfigure WCCP to that script.

  • Stopping EEM/TCL script

    How can I stop a pending EEM/TCL script?  I have a Catalyst 4506 version 12.2(40)SG.  The command 'event manager scheduler clear' isn't available.  The output of 'show event manager policy pending' shows:
    No.  Time of Event             Event Type          Name
    1    Wed Mar 3  09:39:31 2010  none                script: test_err.tcl
    2    Wed Mar 3  10:56:42 2010  timer watchdog      script: free_mem.tcl
    3    Wed Mar 3  11:43:19 2010  syslog              applet: Login-Fail
    So the policies coming after the stuck policy won't run.  I've tried to un-register/re-register the policy, but it didn't help.

    If your device does not support "event manager scheduler clear" the only way to terminate a stuck, or long-running EEM policy is to reboot.

  • EEM TCL script configuration issue

    Hi Experts,
    I need help with an EEM TCL script for the CRS platform that generates a SYSLOG message after the CPU reaches a threshold value and then stays over the threshold value for 15 minutes, I've already tryied several thing and the last TCL script that I tested generated the SYSLOG message when the CPU reaches the threshold but I can't seem to find any way to make it wait the 15 min over the threshold and then generate the message.
    My current script looks like this:
    ::cisco::eem::event_register_wdsysmon timewin 900 sub1 cpu_tot op ge val 70
    namespace import ::cisco::eem::*
    namespace import ::cisco::lib::*
    array set event_details [event_reqinfo]
    action_syslog msg "sub1 is $event_details(sub1)"
    action_syslog msg "High CPU threshold value over 70%"
    puts ok
    I've tryied using the 'period' option for the 'cpu_tot' variable but the TCL script was'nt recognized and couldn't be registered, and I'm using the 'timewin' option here but it seems to be wrong as it says it's the time it has for multiple sub-events to ocurr in order for the script to execute.
    timewin
    (Optional) Time window within which all of the subevents have to occur in order for an event to be generated and is specified in SSSSSSSSSS[.MMM] format. SSSSSSSSSS format must be an integer representing seconds between 0 and 4294967295 inclusive. MMM format must be an integer representing milliseconds between 0 and 999).
    Also, the 'period' option I believe wouldn't have worked because I understand that it referrs to the time period that the script will take to monitor the CPU:
    •1. cpu_tot [op gt|ge|eq|ne|lt|le] [val ?] [period ?]
    op
    (Optional) Comparison operator that is used to compare the collected total system CPU usage sample percentage with the specified percentage value. If true, an event is raised.
    val
    (Optional) Percentage value in which the average CPU usage during the sample period is compared.
    period
    (Optional) Time period for averaging the collection of samples and is specified in SSSSSSSSSS[.MMM] format. SSSSSSSSSS format must be an integer representing seconds between 0 and 4294967295, inclusive. MMM format must be an integer representing milliseconds between 0 and 999. If this argument is not specified, the most recent sample is used.
    As I said, I couldn't try this because the script send an error when I tried to register using the following line:
    ::cisco::eem::event_register_wdsysmon sub1 cpu_tot op ge val 70 period 900
    This is the error message that appeared:
    RP/0/RP0/CPU0:CRS(config)#event manager policy test.tcl username cisco
    RP/0/RP0/CPU0:CRS(config)#commit
    Thu Aug 29 12:35:43.569 CDT
    % Failed to commit one or more configuration items during a pseudo-atomic operation. All changes made have been reverted. Please issue 'show configuration failed' from this session to view the errors
    RP/0/RP0/CPU0:CRS(config)#sh conf fail
    Thu Aug 29 12:35:52.427 CDT
    !! SEMANTIC ERRORS: This configuration was rejected by
    !! the system due to semantic errors. The individual
    !! errors with each failed configuration command can be
    !! found below.
    event manager policy test.tcl username cisco persist-time 3600
    !!% Embedded Event Manager configuration: failed to retrieve intermediate registration result for policy test.tcl
    end
    Anyway, to make this work I understand that I need nested TCL scripts that do the following:
    •1. Monitor the CPU and when it reaches the threshold install another TCL policy that counts down 15 min.
    •2. If the second TCL policy reaches zero then it should generate the SYSLOG message.
    •3. Monitor the CPU while this is running and if it falls below the threshold it should stop the second TCL policy.
    I don't know how I can acomplish this so if anyone can help me with this or show me another way to do this I would really appreciate it.
    Thanks in advance for all your help!

    Neither option is likely to do what you want.  The timewin is for correlating multiple events, and period is the polling interval.  What you want is to create a timer when the CPU is first detected as being high, countdown 15 minutes, then alert you.  You can do this with a nested EEM policy.  For example, you can add the following to your existing policy:
    proc get_pol_dir { fd } {
        set res {}
        set output [cli_exec $fd "show event manager directory user policy"]
        set output [string trim $output]
        regsub -all "\r\n" $output "\n" result
        set lines [split $result "\n"]
        foreach line $lines {
            if { $line == "" } {
                continue
            if { ! [regexp {\s} $line] && ! [regexp {#$} $line] } {
                set res $line
                break
        if { $res == {} } {
            return -code error "The user policy directory has not been configured"
        return $res
    if { [catch {cli_open} result] } {
        error $result $errorInfo
    array set cli $result
    set output [cli_exec $cli(fd) "show event manager policy registered | inc tm_alert_high_cpu.tcl"]
    if { [regexp {tm_alert_high_cpu.tcl} $output] } {
        exit 0
    set poldir [get_pol_dir $cli(fd)]
    set polname "${poldir}/tm_alert_high_cpu.tcl"
    set fd [open $polname "w"]
    puts $fd "::cisco::eem::event_register_timer countdown time 900"
    puts $fd "namespace import ::cisco::eem::*"
    puts $fd "namespace import ::cisco::lib::*"
    puts $fd "action_syslog msg \"CPU has been over 70% for 15 minutes\""
    close $fd
    cli_exec $cli(fd) "config t"
    cli_exec $cli(fd) "event manager policy tm_lert_high_cpu.tcl username eem"
    cli_exec $cli(fd) "commit"
    cli_exec $cli(fd) "end"
    catch {cli_close $cli(fd) $cli(tty_id)}
    Additionally, you'll want another permanently configured policy that checks for a low CPU threshold.  Something like:
    ::cisco::eem::event_register_wdsysmon sub1 cpu_tot op le val 10
    namespace import ::cisco::eem::*
    namespace import ::cisco::lib::*
    if { [catch {cli_open} result] } {
        error $result $errorInfo
    array set cli $result
    cli_exec $cli(fd) "config t"
    cli_exec $cli(fd) "no event manager policy tm_alert_high_cpu.tcl"
    cli_exec $cli(fd) "commit"
    cli_exec $cli(fd) "end"
    catch {cli_close $cli(fd) $cli(tty_id)}

  • How to disable and enable a java bean area's visability?

    I have a large javabean area on my initial canvas when first dispalying my form.
    When I use the SHOW_CANVAS('canvas name') to display another canvas, everything looks fine except that the javabean from my previous canvas is still visible and covering up portions of this new canvas.
    So I tried using the set_property visible for the javabean area in the form and it only got rid of the surrounding edge of the javabean area.
    Last I made some set_custom_property values to send to the bean that would then use java calls to enable and disable the beans visability.
    But once the beans visibility was disabled in Java then it wouldn't come back after the calls to enable the visibility and refresh the bean were made through Java calls.
    Is there any other ways of disabling and enabling a java bean area's visability?
    Thanks,
    Michelle

    Hello,
    Maybe the bean is always display because of its particular paint() method ?
    Anyway, without any reflexion, I could suggest you to set the bean item width and height to 1 pixel when you don't want to display it. (Set_Item_Property)
    Francois

  • Disable and enable field at runtime in sap crm 2007

    Dear experts!
       I created 2 new fields on Opportunity type by EEWB. The first field is checkbox type, is called FIELD1. The second is dropdown list type, is called FIELD2. My problem is: In general, if FIELD1 is not checked, FIELD2 is disalbe. When i checked FIELD1, FIELD2 is enable, enable to choose a value in dropdown list value of FIELD2. But, i don not know how to do it.  Can you help me resolve this problem?
       Thanks alot!
       Longndtb.

    Thanks Amar Nath and sijokjohn85 for your answer!
       But maybe i have not described clearly to you understand, so your solution has not resolved my problem. I will describe more detail as following:
       - I create 2 transaction type ZOP01 and ZOP02 are BUS200111 object type. And using EEWB to generate 2 fields type input field are ZZFN01 and ZZFN02 on those transaction type. Because 2 Trans type are common component BT111H_OPPT, so 2 fields ZZFN01 and ZZFN02 will display on Web UI together when i create either of 2 trans type. Problem is if i create new opportunity type ZOP01, only ZZFN01 is enable, ZZFN02 is disable. and if i create new opportunity type ZOP02, only ZZFN02 is enable, ZZFN01 is disable. Your solution to resolve this problem. But, i done it, and my thread do not question about  this.
       - My problem is: I create 2 field are ZZFN01 and ZZFN02 on transaction type ZOP01. ZZFN01 is checkbox type, ZZFN02 is dropdown box. (i do not question: How to make ZZFN01 is check box and ZZFN02 is dropdown box, i done it). I want that: when ZZFN01 is not checked, ZZFN02 is disable and when i checked the ZZFN01 then, ZZFN02 goes from disable to enable, immediately? I create method GET_I_ZZFN02, in this method, i put some code lines to check ZZFN01 and return to PA_RETURN_ZZFN01. if (PA_RETURN_ZZFN01 = ' ', then make ZZFN02 is disable. If (PA_RETURN_ZZFN01 = 'X', then make ZZFN02 is enable). when i create new opportunity type ZOP01, the ZZFN01 is not checked, so ZZFN02 is disable, of course. Next, i check ZZFN01, how to method GET_I_ZZFN02 recheck the ZZFN01 to make ZZFN02 is enable? This is my problem, and i question about this! So, can you help me?
       Thanks for your concern!
       Longndtb.

  • Disabled and enable clips look the same

    Is there a way to change the preferences so that disabled clips show up dark in my timeline? Because right now they are showing up bright regardless of whether they are disabled or enabled?

    I know that's how it's supposed to work but for some reason mine isn't. It does show up that way on my laptop though.
    screenshot(s)
    http://i114.photobucket.com/albums/n243/peetiewonder/disabledenabled_zps6bfa6044 .png

  • Unable to disable the "Enable Administration Port" (Weblogic 12.1.1.0)

    Hi,
    I have a Weblogic server installation from which the field "Enable Administration Port" has been checked (Probably the Administration Port is now 9002, but I cannot check it).
    As a consequence I am unable to access the Console.
    When I try to access the Console through the 7001 port, I get the message:
    Console/Management requests or requests with <require-admin-traffic> specified to 'true' can only be made through an administration channel.
    Does someone know how to disable the "Enable Administration Port"? Maybe with WSLT?
    Thanks and Regards.

    Solved. Port 9004 can be accessed through https.

  • Looking for a good Javascript to let me know if the "Enable applet plug-in and Web Start Applications is enabled" is disabled or enabled within Java Preferences?

    If this code could work on Snow Leopard as well, that would be awesome. I have a code to tell if Java is enable or disabled on any web browser, but it does not detect if the Java Preferences "Enable applet plug-in and Web Start Applications is enabled" is enabled or disabled. Just looking for a specific code to tell if this option is disabled or enabled.
    Thank you

    Launch Applications/Utilities/Java Preferences.app by double-clicking.
    EDIT; But I think you are confusing this with JavaScript which has nothing to do with it.

  • Cannot disable or enable Bluetooth with user rights

    Hi,
     If user do not have administrator rights he/she cannot disable or enable bluetooth using Fn+F5 menu.Is there any solution to this problem?

    Still looking for solution....

  • I recently had to disable and enable all add-ons on Firefox. Now when I google something, when I hover over the website preview and click 'cached' it won't highlight the key terms anymore. How can I fix this?

    I recently had to disable and enable all add-ons on Firefox. Now when I google something, when I hover over the website preview and click 'cached' it won't highlight the key terms anymore. How can I fix this?

    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    *Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • How to register EEM Tcl script

    Hello,
    I've a EEM tcl script in bootflash. How to register EEM script. I did the following but it couldn't locate the script in bootflash.
    switch2(config)#event manager policy bootflash:eem-stuckcpu.tcl type user
    EEM configuration: policy file bootflash:eem-stuckcpu.tcl could not be found
    switch2(config)#
    switch2(config)#event manager policy eem-stuckcpu.tcl type user          
    EEM configuration: policy file eem-stuckcpu.tcl could not be found
    Thanks,
    /aa

    You need to configure:
    event manager directory user policy bootflash:
    Then use:
    event manager policy eem-stuckcpu.tcl

  • IP SLA EEM/Tcl Scripts

    Hello Community,
    I have been testing a EEM/Tcl scripts for IP SLA. However, after testing I realised that the script didn't go far enough in identifying the link(s) that has actually gone down.
    I was wondering if someone knows any good EEM/Tcl scripts for IP SLA?
    Cheers
    Carlton

    What about it doesn't work?  Is the policy not triggering?  Is the IPSLA operation not transitioning state?

  • EEM TCL Policies

    All,
    I am attempting to write a TCL based EEM policy to force users that entering config mode on the router to enter a ticket number from my company's service management platform, since any changes they make to a production system should be tied to either an incident or approved change.  I've got this working based on a TCL script I found on Cisco Beyond.  I utilize a product from Solarwinds (Network Configuration Manager or NCM) to make mass changes across my router install base.  I don't want the credentials that the NCM product uses to have to enter a ticket number as it complicates programming responses on that platform.  I can do it if necessary, but I was hoping there might be a way to make it so that if user "x" is entering config mode the TCL script could bypass the other actions and not prompt for a ticket number.  If this were not an EEM TCL policy I could simply perform an exec command to show users and parse the active line to get the username, then do a regexp match and if it were the NCM user set a flag and use if statements to bypass the other code.  But because it's an EEM TCL policy, exec is available to me, only cli_open, cli_exec, cli_close, which actually opens a new session to the router which negates my previous idea since it's not the actual session of the user that's trying to enter config mode that the show users command would be executing against.  If anyone has any other ideas on how I might do this I'd appreciate the feedback.  Thanks.
    Mike

    Joe,
    Thanks for the response.  I've added your example to the script (modifying for the NCM Username of course), but I'm getting an error I'm not sure how to handle.  The following is what I'm getting:
    invalid command name "*"
        while executing
        invoked from within
    "$slave eval $Contents"
        (procedure "eval_script" line 7)
        invoked from within
    "eval_script slave $scriptname"
        invoked from within
    "if {$security_level == 1} {       #untrusted script
         interp create -safe slave
         interp share {} stdin slave
         interp share {} stdout slave
        (file "system:/lib/tcl/base.tcl" line 50)
    Tcl policy execute failed: invalid command name "*"
    It seems to be trying the execute the wild card in the regular expression used in the cli_exec command.  I'm not familiar enough with TCL to debug this and figure out how to fix it.  If you have any ideas on the matter I'd appreciate it.  Your guidance would be most welcome.  Thanks.
    Mike

  • How can I change the status of the fileupload UI from disable to enable?

    Hi, experts,
    The Version of my Netweaver studio is 7.0.11.
    I create a view with fileupload UI element in WebDynpro for Java application, but the fileupload UI element is disabled so that I don't select file when I click the button in the fileupload UI element after I run the application.
    How can I change the status of the fileupload UI element from disable to enable?
    Best regards,
    tao

    Hi
    look at this thread [HI Masters , I need information for file upload program in web dynpro java|HI Masters , I need information for file upload program in web dynpro java]
    and check if u bind each file upload element to binary property in the context

Maybe you are looking for