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)}

Similar Messages

  • 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

  • EEM-TCL Script to switch config from interface X to interface Y

    Hello Guys,
    I’m trying to create a script which is controlled by an EEM-UPDOWN event of an interface. What I’m trying to do is, if interface X is down for some reason it should copy the interface configuration to interface Y.
    So my problem is I’m very new to eem-tcl scripting and I have some basic problem hopefully u can help me =) I’m working on a ASR9K !
    So what i have done so fare:
    ::cisco::eem::event_register_syslog occurs 1 pattern ".*CHANGED.*$_sat_1_link_1.*" maxrun 90   
    namespace import ::cisco::eem::*
    namespace import ::cisco::lib::*
    array set arr_einfo [event_reqinfo]
    if {$_cerrno != 0} {
        set result [format "component=%s; subsys err=%s; posix err=%s;\n%s" \
          $_cerr_sub_num $_cerr_sub_err $_cerr_posix_err $_cerr_str]
        error $result
    if [catch {cli_open} result] {
        error $result $errorInfo
    } else {
        array set cli1 $result
    action_syslog priority emergencies msg "start script testv1_1"
    #puts "\nEXECUTE CLI COMAND :\n"
    set out {cli_exec $cli1(fd) "show running-config formal interface $_sat_1_link_1"}
    set xout [split $out \n]
    #puts "DEBUG : $xout \n\n"
    set anz [llength $xout]
    #puts "DEBUG : count rows = $anz \n\n"
    for {set ii "0"}  {$ii < $anz } {incr ii} {
           set indexout [lindex $out $ii]
        regexp  {([\w]+)[ ]([\w\d/]+)\s(.*)} $indexout a b c d
        #puts "\nDEBUG START"
        #puts "\nindex Nr  $ii"
        #puts "Full Match: $a"
        #puts "Sub Match1: $b"
        #puts "Sub Match2: $c"
        #puts "Sub Match3: $d"
        #puts "DEBUG END\n"
        set intsrc {cli_exec $cli1(fd) "no $b $_sat_1_link_1 $d"}
        set intdest {cli_exec $cli1(fd) "$b $_sat_1_link_2 $d"}
    if [catch {cli_exec $cli1(fd) "commit"} result] {
        error $result $errorInfo
    if [catch {cli_exec $cli1(fd) "end"} result] {
        error $result $errorInfo
    action_syslog priority emergencies msg "End script testv1_1"
    ps. $_sat_1_link_1 and $_sat_1_link_2 are globaly set per cli in the event manager env.
    Thanks for your help and hopefully u can help me with this script

    Hey
    after show running-config formal interface TenGigE 0/0/2/1 the cli output example is :
    interface TenGigE0/0/2/1 description Test: 0-43
    interface TenGigE0/0/2/1
    interface TenGigE0/0/2/1 shutdown
    and now i want to split the config with my regex
    regexp  {([\w]+)[ ]([\w\d/]+)\s(.*)} $indexout a b c d
    As example line 1
    set x= "TenGigE0/0/2/2"                  --> =dest_interface
    a= interface TenGigE0/0/2/1 description Test: 0-43
    b= interface
    c= TenGigE0/0/2/1
    d= description Test: 0-43
    do this
    cli_exec $cli1(fd) "no $b $c $d"      --->no interface TenGig E0/0/2/1 description Test: 0-43
    cli_exec $cli1(fd) " $b $x $d"          ---> interface TenGigE0/0/2/2 description Test: 0-43
    and from this point it shoud do this until there are no config lines  =)
    as a final result is should copy the whole config from interface X to interface Y  if the trigger is active
    but as i see, the main problem is to get the CLI output in a format like this
    set xy = interface TenGigE0/0/2/1 description Test: 0-43\ninterface TenGigE0/0/2/1\ninterface TenGigE0/0/2/1 shutdown
    or in an index like this:
    Index | command
    1         interface TenGigE0/0/2/1 description Test: 0-43
    2         interface TenGigE0/0/2/1
    3         interface TenGigE0/0/2/1 shutdown
    Thx

  • 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?

  • 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 Help Please

    Hello Community,
    I have been evaluating a Tcl Script posted here sometime ago, designed to help monitor track interfaces and routes, see attached.
    I believe I have applied the configurations correctly, however when I test the script by shutting down interfaces nothing happens.
    I'm sure its something very simple that I'm missing.
    I wonder if someone could take a look at the configs and let me know what I'm doing wrong. I have also attached a diagram.
    Cheers
    Carlton

    Joseph,
    I did read again and I got it to work :-)
    Cheers
    On a slightly different topic, is it possible to 'track' a static ip address?
    For example, I have the following tracking configured:
    track 1 ip route 0.0.0.0 0.0.0.0 reachability
    track 2 interface FastEthernet0/0 ip routing
    track 3 interface FastEthernet0/1 ip routing
    track 4 ip route 180.80.8.4 255.255.255.255 reachability
    track 5 ip route 170.70.7.4 255.255.255.255 reachability
    R3#show track brie
    Track   Object                         Parameter        Value
    1       ip route  0.0.0.0/0            reachability     Up (static)
    2       interface FastEthernet0/0      ip routing       Up
    3       interface FastEthernet0/1      ip routing       Up
    4       ip route  180.80.8.4/32        reachability     Down (no route)
    5       ip route  170.70.7.4/32        reachability     Down (no route)
    However, you will see that track 4 and 5 are down. This is because, although I can ping 180.80.8.4 and 170.70.7.4 the actual ip addresses don't appear in the routing table:
    Gateway of last resort is 0.0.0.0 to network 0.0.0.0
         170.70.0.0/24 is subnetted, 1 subnets
    C       170.70.7.0 is directly connected, FastEthernet0/0
         10.0.0.0/24 is subnetted, 1 subnets
    C       10.1.1.0 is directly connected, FastEthernet1/0
         180.80.0.0/24 is subnetted, 1 subnets
    C       180.80.8.0 is directly connected, FastEthernet0/1
         150.50.0.0/24 is subnetted, 1 subnets
    C       150.50.5.0 is directly connected, Ethernet2/0
    S*   0.0.0.0/0 is directly connected, FastEthernet1/0
    R3#
    Therefore, is there way of creating a track for /32 ip addresses?
    I hope that makes sense.
    Cheers

  • Router Crashs when using EEM(TCL script)

    I wrote a TCL script to deal with my  dual-link router, but the script running for some time will case the router crash.Could you help me for this?
    Is there some problem with my script ?Thank you!
    Routers :CISCO2821
    IOS vesion:12.4(15)T8

    This looks like CSCsv52332.  This bug is fixed in 12.4(15)T10.

  • SNMP GET operation via EEM Tcl Scripting

    Hi Experts,
    I am writing to you because I was browsing through the archives and saw in one discussion the following command:
    sys_reqinfo_snmp_set oid 1.3.6.1.2.1.2.2.1.7.2.3 int 2 community private ipaddr 1.1.1.1
    I am trying to the get the "get" version of the above command. This means a command that gives you the ability to poll an external/remote SNMP Agent MIB. This is the reason I highlited the "ipaddr" keyword.
    The following command gives you the option to locally poll an object, but it does not give you the option (as indicated in the available literature) to do it on an external device:
    sys_reqinfo_snmp oid ? get_type exact|next
    In applet configuration mode there is a way to achieve that but I have not found any indication on how to do it via Tcl, which supposedly supersedes what you can do via applet configuration.
    Thanks in advance for you knowledge and help.

    Assuming you have a new enough version of EEM, the command is:
    sys_reqinfo_snmp oid OID get_type {exact|next} community COMMUNITY ipaddr IPADDR

  • EEM/Tcl Script Assistance Part3

    Hello Community,
    Attached is a script originally posted by Joseph.
    When I apply the script I get the following error message:
    R2(config)#event manager policy switchstats.tcl  
    Compile check and registration failed:policy file does not start with event register cmd: file
    Tcl policy execute failed: policy file does not start with event register cmd: file
    Embedded Event Manager configuration: failed to retrieve intermediate registration result for policy switchstats.tcl: Unknown error 0
    I was wondering if someone could take a quick look and let me know what the problem is/
    Cheers

    Hello Community,
    I realised what I was doing wrong, so please ignore the original post.
    However, I get the following error on line 22 when I run the script.
    uk0149_SW2960_100Cheapside#tclsh switchstats.tcl
    extra characters after close-quote
        while executing
    "puts $filename "switch, interface, packets input,bytes,no buffer,broadcasts,multicasts,runts,giants,throttles,input errors,CRC,frame,overrun,ignored,w..."
        (file "switchstats.tcl" line 22)
    Line 22 is:
    puts $filename "switch, interface, packets input,bytes,no buffer,broadcasts,multicasts,runts,giants,throttles,input errors,CRC,frame,overrun,ignored,watchdog,multicast,pause input,input packets with dribble condition detected,packets output,bytes,underruns,output errors,collisions,interface resets,babbles,late collision,deferred,lost carrier,no carrier,PAUSE ,output buffer failures,output buffers swapped out"
    Can you help?
    Cheers

  • Using EEM and TCL scripts for voice

    HI all,
    I'd like to use eem to check Sip dial-peer status+interface BRI status, when sip dial-peer has no answer to invite and bri interface is down the LAN interface must be shutted down. Is it possible to avhieve it using eem? I didn't find anything for eem monitoring sip dial-peers...
    thanks
    Massimiliano

    EEM doesn't have any ability to control the data plane currently.  Therefore, there is no direct voice tie-in.  There is a way to do Tcl scripting of some voice operations (e.g. IVR scripts), but those do not relate to EEM.
    That said, if there are some show commands which provide you the data you need, you can create an EEM timer policy (i.e. one that runs periodically), parsers the show command output, and takes further action if the output contains certain patterns.  Depending on the version of IOS, this may require an EEM Tcl script, or you may be able to do it within an EEM applet.
    If you need further assistance, you will need to provide your IOS version, and the exact commands (and output) which would tell you if the SIP peer isn't getting an answer and the BRI interface is truly down (I'm imagining something like "show isdn status" for this one).
    Please support CSC Helps Haiti
    https://supportforums.cisco.com/docs/DOC-8895
    https://supportforums.cisco.com

  • 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.

  • I need an EEM for TCL script

    Hello All,
    This is my first time here and hope this is right place to post this:
    I have a TCL script written by a very help person that sends a tone over my PA System from my CME.  I would like to have an EEM script to automatically run the script at certain times a day.  Please be advised this is my introduction to both TCL and EEM.  Any help is appreciated.
    application
    service paging flash:paging_89.tcl
      param prompt-1 flash:500hz.au

    I don't think you can schedule this script to run using EEM.  It's an IVR script, and I think it has to be configured the way you have it.  I'm not an IVR expert, though.  You might want to ask on one of the voice communities here if this script can be run manually.  If it can, then you can use EEM to schedule it.

  • CallManager Express TCL Script issue

    Hi, I'm having issues trying to get an AA script working on a CME 4.0 system. What I want to do is quite simple, i just want to play a message to callers and that's it.
    When I dial the pilot, the call just drops and I get the following error when debugging "voip application script"
    Jul 25 17:16:22.470: //381//TCL :/tcl_PutsObjCmd: TCL AA: +++ B-ACD-SERVICE not registered, Starting B-ACD-SERVICE +++
    Jul 25 17:16:22.470: //381//AFW_:/AFW_FSM_Drive: Tcl_Eval to drive FSM inside Tcl modulespace. code=1 code=ERROR
    Jul 25 17:16:22.470: TCL script failure
    Result:
    Handoff Failed
    Jul 25 17:16:22.470: TCL script failure errorInfo:
    Handoff Failed
    while executing
    "handoff appl leg_incoming $serviceName -s $hString"
    (procedure "act_Setup" line 30)
    invoked from within
    "act_Setup"
    (procedure "act_Handoff_Activity" line 7)
    invoked from within
    "act_Handoff_Activity"
    Below is my config
    application
    service aa flash:app-b-acd-aa-2.1.0.0.tcl
    paramspace english index 1
    param number-of-hunt-grps 1
    param handoff-string aa
    paramspace english language en
    param max-time-vm-retry 3
    param aa-pilot 1050
    paramspace english location flash:
    param second-greeting-time 60
    param welcome-prompt _bacd_welcome.au
    param queue-manager-debugs 1
    param call-retry-timer 15
    param max-time-call-retry 200
    param voice-mail 8000
    param service-name aa
    dial-peer voice 1050 voip
    service aa
    destination-pattern 1050
    session target ipv4:172.27.27.10
    incoming called-number .
    dtmf-relay h245-alphanumeric
    codec g711ulaw
    no vad
    telephony-service
    load 7914 S00104000100
    load ATA ATA030100SCCP040211A
    load 7920 cmterm_7920.4.0-02-00
    load 7971 TERM70.6-0-3SR1S
    load 7970 TERM70.6-0-3SR1S
    load 7912 CP7912080001SCCP051117A
    max-ephones 240
    max-dn 480
    ip source-address 172.27.27.10 port 2000
    timeouts interdigit 5
    system message Galaxia - VSAT Activated
    sdspfarm units 1
    sdspfarm transcode sessions 2
    sdspfarm tag 1 mtp0018185bf860
    cnf-file perphone
    network-locale IT
    time-zone 23
    time-format 24
    date-format dd-mm-yy
    max-conferences 8 gain -6
    call-park system redirect
    call-forward pattern .T
    moh music-on-hold.au
    multicast moh 239.x.1.30 port 2123
    web admin system name admin password btin3t
    dn-webedit
    time-webedit
    transfer-system full-consult
    secondary-dialtone 9
    create cnf-files version-stamp 7960 Jul 25 2006 14:09:58
    We do not have CUE.
    Any help would be appreciated.
    Thanks
    Glyn

    In reference to this part of your config:
    If you are using a hunt group, you need the following param:
    param aa-hunt1
    I would also try using a loopback addres in your voip dial peer, rather than the H.323 physical IP addres of your router.
    here is the link with an example config:
    http://www.cisco.com/en/US/partner/products/sw/voicesw/ps4625/products_configuration_guide_chapter09186a00805f2305.html#wp1012136

  • Signing byte-encoded TCL script for EEM

    Good day,
    I am trying to figure out how to sign a TCL script which is distributed in byte-encoded form.
    The byte coding is performed with TCL pro (http://sourceforge.net/projects/tclpro/files/TclPro-1.4.1/)
    Any pointers on how to do it will be much appreciated.
    Regards,
    Alexei

    EEM 3.4 should support third party signing of Tcl policies.  As to whether or not byte-code compiled policies will be supported is uncertain.  However, you should be able to sign a byte-code compiled Tcl script (regular Tcl script, and not EEM policy) by putting the signature after the closing tbcload '}'.  I assume the same thing will eventually be doable with EEM.

  • Running a TCL script through EEM every 60 seconds

    I have a script written in the TCLSH of IOS, I can test this script from the shell using the following commands
    LAB-RTR#tclsh
    LAB-RTR(tcl)#source flash:test.tcl
     NO CALLS
    Is there a way I can run this test.tcl script every 60 seconds on the router.
    SCRIPT test.tcl
    proc get_ints {} {
    set syslog [open "syslog:" w+]
    #puts "BEFORE\n"
    set check ""
    set int_out [ exec "show voice call status\n" ]
    #puts "INTOUT $int_out\n"
    set mylist [regexp -nocase -line -inline {(^([0-9]*|No) active calls? found)} $int_out]
    #puts "MYLIST $mylist\n"
    foreach int $mylist {
     #puts "INT $int\n"
     if {$int == "No"} {
      puts " NO CALLS\n";
      puts $syslog "NO CALLS"
     } elseif {[string is integer -strict $int]} {
      puts "$int CALLS\n";
      puts $syslog "$int CALLS"
     } else {
      #puts "GARBAGE\n";
    close $syslog
    #puts ""
    puts [eval get_ints]

    Hey Joseph, Thanks for all your help. I have one last question, so now that I am running my script every 60 seconds if there is an issue I send multiple traps to our monitoring system. Is there any way you can keep track if the trap was already sent I will not send another trap again.
    One way I can think of is using a loopback interface. But I would prefer not shutting down the loopback interface just to keep track of what my script is doing.
    IF issue {
       IF Loop1 is up {
                don't send trap
        } ELSE {
                bring Loop1 up
                Send Trap
     } ELSE (No issue) {
       shutdown Loop1

Maybe you are looking for