Drawbacks of EEM applet

As i am going to configure EEM applet for TFTP backup on my cisco production device, I want to know weather there are any drawbacks of EEM applet like resources consumtion etc.

Hi Joseph,
I am going to use below applet for Automatic TFTP backup.
action 1 cli command "enable"
action 2 cli command "configure terminal"
action 3 cli command "file prompt quiet"
action 4 cli command "end"
action 5 cli command "copy running-config tftp://tftp-server/router-confg"
action 6 cli command "configure terminal"
action 7 cli command "no file prompt quiet"
action 8 cli command "end"
Do I need to take any precautions during this applet configuration ?

Similar Messages

  • EEM Applet Problem With: event syslog pattern ".*" priority 2

    I went to create a EEM applet that would be invoked whenever any syslog message of priority 0-2 was invoked. I figured  the following event statement would work
           event syslog pattern ".*" priority 2
    I never really used the priority optional argument before but thought I understood from the docs that messages at or numerically lower than the specified level are matched.
    Well it doesn't seem to work as documented.  Seems to me that only messages at the specified level are beng matched and not messages numerically lower than the specified level.
    Anyway I did what I wanted differently but wanted to post this in case this is a bug in the syslog ed.

    Actually, it's a problem with the documentation.  The priority option only matches the specified severity.  What you could do is adjust pattern to do this:
    event syslog pattern "*-[012]-"

  • EEM applet does not support extended ping ?

    Hi does anybody know if EEM applet does not support any extended Ping in a cli action ?
    This works:
    action 1000 cli command "ping ip 10.161.255.5"
    These statements does not work ?
    action 1000 cli command "ping ip 10.161.255.5 repeat 10 source Loopback0"
    action 1000 cli command "ping vrf TESTVRF ip 10.161.255.5 repeat 20 source Loopback0"
    I  found another possibility how to achive extended ping in EEM like following
    event manager applet ping
    event none sync yes
    action 100 cli command "enable"
    action 101 cli command "ping" pattern "[ip]"
    action 102 cli command "ip" pattern "address"
    action 103 cli command "10.161.255.5" pattern "count"
    action 104 cli command "20" pattern "size"
    action 105 cli command "100" pattern "seconds"
    action 106 cli command "2" pattern "commands"
    action 107 cli command "y" pattern "interface"
    action 108 cli command "Loopback0" pattern "service"
    action 109 cli command "0" pattern "header"
    action 110 cli command "no" pattern "data"
    action 111 cli command "no" pattern "pattern"
    action 112 cli command "0xABCD" pattern "Verbose"
    action 113 cli command " " pattern "size"
    action 114 cli command "n" event manager applet ping
    bu there is also no way to specify the VRF ?
    Any Ideas ?
    Thx
    Hubert

    Hi found failure,
    extended ping needs to be executed in priviledged mode, so need to enable in advance , then it works
    thx Bruno for the hint
    Hubert

  • Eem applet or script for sending email for syslog denies

    I am wanting to have my isr's send an email when a certain number of deny's occur on an ace.  So if i have a particular ace set up to log when tcp 3389 denied.  Then the eem applet or script would track when that deny entry happens.  When the deny hits on that entry reach three times, it will send an email alert.  The thing i am wondering about is how to set a variable within an event syslog pattern statement.  For instance, how do i say express a variable for the source ip/port in the below
    config-applet)# event syslog pattern "SEC-6-IPACCESSLOGP: list 198 denied tcp 201.198.71.51(38531) -> 212.184.81.52(3389)" occurs 3
    The source ip and port could rotate or change so i'd need to express that with some kind of variable.  How could that be done?(or is there a better approach altogether). 

    I put the below script in and it takes fine but does not send email alert.  Is there something more to do for configuring email sending? 
    event manager applet Intrusion-Tracking
    event syslog pattern "SEC-6-IPACCESSLOGP:.*-> 208.195.174.115\(3389\)" occurs 3
    action 1.0 mail server "173.16.7.2" to ".[email protected]" from ".eem@company1." subject ".intrusion_alert_from_c2900isr." body "Intrustion alert c2800isr"

  • EEM applet that triggers on high CPU utilization

    Hi Folks,
    I am trying to create an eem applet which triggers on high cpu utilization (detected by erm).   The applet should then tftp the output from "show proc cpu sorted" to a tftp server.   
    I am trying to configure this on a 1841 running 124-24.T3 code
    This is my config:
    resource policy
      policy HighGlobalCPU global
       system
        cpu total
         critical rising 5 falling 2 interval 10
        cpu process
         critical rising 5 falling 2 interval 10
    ! I'm not sure whether it is correct to monitor 'cpu total' or 'cpu process'.   The rising thresholds are deliberately low to maker testing easier
    event manager applet ReportHighCPU
    event resource policy "HighGlobalCPU"
    action 1.0 cli command "show process cpu sorted 5sec | redirect tftp://192.168.1.1/highCPU$_resource_time_sent.txt"
    action 2.0 syslog priority debugging msg "high cpu event detected, output tftp sent"
    The problem is that I can't seem to trigger the applet.    I have generated enough traffic to push the cpu utilization to over 30% (according to 'show proc cpu'), but the applet does not appear to trigger (no syslog messages appear, and my syslog server does not receive anything).
    If anyone can tell me what I've done wrong here I would be very grateful!
    Thanks,
    Darragh

    I am just replying off the top of my head but I believe you
    need to also add to your conf the line
    user global HighGlobalCPU

  • EEM Applet - Interface bandwidth utilization

    We are planning to get syslog or snmp alert for bandwidth utilization of Uplinks by EEM applet, can any bdy help me on that?
    We managed to get alert for input traffic but we are not able to get alert for total bandwidth utilization ( input + output ).

    This is possible with an EEM applet.  I have done it on G1 ISRs with 15.1.  The applet is here:
    http://ephemeralportal.blogspot.jp/2014/01/eem-applet-teach-your-router-to-monitor_24.html
    I usually run 12.4 on 3745s in GNS3 and they do not have the action set to do variable manipulation, so I am guessing that this is a newer feature, although I could not find what minimum version you would need on a quick search.

  • EEM applet to reload router after ip is unreachable over time

    Hi
    I am trying to create an EEM applet that will track the reachability of a group of  IP addresses. The condition needs to be as followed:
    If the IP addresses become unreachable for about an 1 hour 15 minutes then reload the router. I have looked at the delay command using the IP SLA option but it only delays up to 180 seconds. Any Ideas?

    The applet that tracks your IP SLA objects (I'm guessing you have a tracked object that tracks a list of other objects) should configure another timer applet that counts down the time you want.  For example:
    event manager applet track-down event track 3 state down action 1.0 cli command "enable" action 2.0 cli command "config t" action 3.0 cli command "event manager applet countdown" action 3.1 cli command "event timer countdown time 4500" action 3.2 cli command "action 1.0 reload" action 4.0 cli command "end"!event manager applet track-up event track 3 state up action 1.0 cli command "enable" action 2.0 cli command "config t" action 3.0 cli command "no event manager applet countdown" action 4.0 cli command "end"

  • EEM applet for IPSLA

    Hi,
    I have a scenario where i would like to execute a EEM applet for running an ip sla event when othe ip sla event is up. Just to summarize an IP sla event success should trigger anothe IP sla event. I have tried the two options below but was not able to find any debug logs.
    ip sla 10
    icmp-jitter x.x.x.x source-ip x.x.x.x num-packets 10
    frequency 30
    ip sla schedule 10 life forever start-time now
    ip sla 20
    icmp-jitter x.x.x.x source-ip x.x.x.x num-packets 10
    frequency 30
    event manager applet SLA
    event timer cron cron-entry "5 * * * *"
    event ipsla operation-id 10 reaction-type timeout
    action 10   if $_ipsla_condition eq "Occurred"
    action 15    cli command "enable"
    action 20    cli command "configure term"
    action 25    cli command "no ip sla schedule 20 life forever start-time now"
    action 30    else
    action 35    cli command "enable"
    action 40    cli command "configure term"
    action 45    cli command "ip sla schedule 20 life forever start-time now"
    action 50   end
    OR
    ip sla 10
    icmp-jitter x.x.x.x source-ip x.x.x.x num-packets 10
    frequency 30
    ip sla schedule 10 life forever start-time now
    ip sla 20
    icmp-jitter y.y.y.y source-ip y.y.y.y num-packets 10
    frequency 30
    track 1 ip lsa reachability
    event manager applet SLA-1
    event timer cron cron-entry "5 * * * *"
    event track 1 state up
    action 10 cli command "enable"
    action 20 cli command "conf t"
    action 30 cli command "ip sla schedule 20 life forever start-time now"
    action 40 cli command "end"
    event manager applet SLA-2
    event timer cron cron-entry "5 * * * *"
    event track 1 state down
    action 10 cli command "enable"
    action 20 cli command '' conf t"
    action 30 cli command "no ip sla schedule 20 life forever start-time now"
    action 40 cli command "end"
    Regards,
    Sathvik K V

    Hi Joseph,
    I would like to run the script pasted below during buisness hours(9am to 6pm).  When two if conditions are used is it the first condition is checked and if that passes it will check the second condition.
    event manager applet APP-1
    event track 1 state up
    action 001 cli command "enable"
    action 002 cli command "show clock"
    action 003 regexp "([0-9]+):[0-9]:[0-9]" $_cli_result match hour
    action 004 if $hour ge 9
    action 005 cli command "conf t"
    action 006 cli command "ip sla 2"
    action 007 cli command "icmp-echo x.x.x.x source-ip x.x.x.x"
    action 008 cli command "frequency 30"
    action 009 cli command "ip sla schedule 2 life forever start-time now"
    action 010 end
    action 011 if $hour le 18
    action 012 cli command "ip sla 2"
    action 013 cli command "icmp-echo x.x.x.x source-ip x.x.x.x"
    action 014 cli command "frequency 30"
    action 015 cli command "ip sla schedule 2 life forever start-time now"
    action 016 end
    event manager applet APP-2
    event track 1 state down
    action 10 cli command "enable"
    action 20 cli command "conf t"
    action 30 cli command "no ip sla 2"
    action 40 cli command "end"
    Regards,
    Sathvik

  • Need help in executing EEM applet only once

    Do we have any sample script for EEM applet counter ?  We want applet to execute once after reload after matching a string . We tried couple of solutions like “ server suspend  “( customer does not like server suspend)   and event counter ( this does not allow syslog string matching ). Please let me know if there are any options.
    At the router reload, match the string , bring down the interface and run this applet only once . I have been trying multiple messages in Bootup log for this for bringing the interface down.
    The issue we are facing is that most of the bootup log messages can be triggered when the router is up as well which will result in triggering of the applet which is what we want to avoid.
    event manager applet Interface_down
    event syslog pattern "SPA removed from subslot 0/0"
    trigger delay 10
    action 1.0 cli command "enable"
    action 1.5 cli command "config t"
    action 2.0 cli command "interface gi0/0/0"
    action 2.5 cli command "shutdown"
    action 3.0 cli command "end"
    event manager applet Interface_up
    event syslog pattern "Bulk Sync succeeded"
    trigger delay 100
    action 1.0 cli command "enable"
    action 1.5 cli command "config t"
    action 2.0 cli command "interface gi0/0/0"
    action 2.5 cli command "no shutdown"
    action 3.0 cli command "end"
    end

    This is a bit dirty but you can create an applet to run at startup that creates the event detection applet. Then at the end of the detection applet, have it remove itself from the running config. This means that the  applet running at startup will always create the event detection applet but the event detection applet will only ever run once for that router boot period as it deletes itself after first run.
    The problem is that when you want to have one applet create another applet, you have issues with the inverted commas being correctly configured for the second applet which will cause it to run once, but fail after that. The way you can get around this is to write the applet to a text file on the flash and then copy the contents of the text file to the running config at boot. This preserves the structure of the applet being created and ensures that it will function correctly.
    The following example builds the event detection applet at system restart (BUILDAPPLET)  by copying the file "eventapplet.txt" to running config. The event detection applet (EVENTDETECT) detects a syslog pattern, in this case exiting global config, and runs the applet sending a puts command and outputting HELLO. The event detection applet then removes itself from the running config.
    !# configure the router
    conf t
    !# turn off file prompting to let the BUILDAPPLET run when copying
    file prompt quiet
    !# create the applet that runs at system restart and copies the flash applet to the running config
    event manager applet BUILDAPPLET
     event syslog pattern "%SYS-5-RESTART"
     action 10 cli command "en"
     action 11 cli command "copy flash:eventapplet.txt running-config"
    !# exit
    end
    !######## Create the flash file containing your run once applet ########
    ! enter the tclsh so we can write our applet to a file - put your event detection applet in here between the {} that you want to run once
    tclsh
    puts [open "flash:eventapplet.txt" w+] {
    event manager applet EVENTDETECT
     event syslog pattern "%SYS-5-CONFIG_I"
     action 1.0 puts "HELLO"
     action 2.0 cli command "en"
     action 3.0 cli command "conf t"
     action 4.0 cli command "no event manager applet EVENTDETECT"

  • N7k: Use of $(TIMESTAMP) in eem applet

    Hi there,
    I'm trying to copy running-config to tftp-server whenever a "copy run start" was executed.
    event manager applet SAVE_TO_TFTP  event cli match "copy running-config startup-config"  action 1.0 cli copy running-config tftp://1.2.3.4/directory/switchname.cfg vrf management  action 2.0 event-default
    Works as expected, but I'd like to append the filename with a timestamp. However if i try this
    action 1.0 cli copy running-config tftp://1.2.3.4/directory/switchname.$(TIMESTAMP).cfg vrf management
    the variable $(TIMESTAMP) will be parsed immediately to this:
    action 1.0 cli copy running-config tftp://1.2.3.4/directory/switchname.2013-04-20-18.52.00.cfg vrf management
    Is there a way to get the actual eem execution timestamp? When using the same syntax in a scheduler config this works great...
    Regards
    Pille

    I know IOS has such a parameter, but I don't see the same parameter in NX-OS.  The only parameter I know will work is $command (the command that was run).  I did some tests, but I don't see a way to do what you want unless you use EEM to execute a tclsh script.  That will give you the ability to build whatever timestamp you want, but it isn't officially supported.

  • Run EEM applet on login

    I am new to EEM and was wondering if it was possible to get an applet to run for a specific user when that user logins to the device? If so, which event would I be looking for?
    Thanks in advance.

    Joseph...thank you very much for the help. I have another question however. I am trying to piece together a very simple script that will show the running config if a particular user logs into the device. So I have this so far:
    event manager applet login
     event syslog pattern "Login Success \[user: testuser]"
     action 1.0 cli command "enable"
     action 2.0 cli command "sh run"
    Once I login as "testuser" it would appear that the applet runs but not in the current session....as in testuser does not see the results. I have tried to add the following
    action 3.0 puts "$_cli_result" 
    But again no difference. Is there a way to pipe the information to the cli session of testuser?
    Thanks again!

  • EEM Applet to Monitor CPU

    I need to what the PID using CPU utilization at 50%.
    All i see on the syslog server is " %HA_EM-2-LOG: highcpu: HIGH CPU"
    EEM doesnt tell me what process is consuming the CPU at 50%
    Any ideas?
    event manager applet highcpu
    event snmp oid 1.3.6.1.4.1.9.9.109.1.1.1.1.10.1 get-type exact entry-op ge entry-val 50 poll-interval 5
    action 1.0 cli command "enable"
    action 2.0 cli command "show proc cpu sorted"
    action 3.0 syslog priority critical msg "HIGH CPU"
    Francisco.

    Joe,
    I have uploaded the script in to flash and trying to register it, i get error below.
    R1(config)#event manager policy tm_alert_high_cpu.tcl
    Compile check and registration failed:Wrong # args, usage is "::cisco::eem::event_register_timer watchdog|countdown|absolute|cron name ? cron_entry ? time ? queue_priority normal|low|high maxrun ? nice ?"
        while executing
    "::cisco::eem::event_register_timer watchdog time $high_cpu_poll_freq
    Tcl policy execute failed: Wrong # args, usage is "::cisco::eem::event_register_timer watchdog|countdown|absolute|cron name ? cron_entry ? time ? queue_priority normal|low|high maxrun ? nice ?"
    Embedded Event Manager configuration: failed to retrieve intermediate registration result for policy tm_alert_high_cpu.tcl: Unknown error 0
    R1(config)#event manager policy tm_alert_high_cpu.tcl
    Compile check and registration failed:Wrong # args, usage is "::cisco::eem::event_register_timer watchdog|countdown|absolute|cron name ? cron_entry ? time ? queue_priority normal|low|high maxrun ? nice ?"
        while executing
    "::cisco::eem::event_register_timer watchdog time $high_cpu_poll_freq
    Tcl policy execute failed: Wrong # args, usage is "::cisco::eem::event_register_timer watchdog|countdown|absolute|cron name ? cron_entry ? time ? queue_priority normal|low|high maxrun ? nice ?"
    Embedded Event Manager configuration: failed to retrieve intermediate registration result for policy tm_alert_high_cpu.tcl: Unknown error 0
    R1(config)#event manager policy tm_alert_high_cpu.tcl

  • EEM - Applet Help Appreciated

    I am using the following applet to modify entries in two ACLs from a mobile device. Please see applet below with output from a test run:
    3    applet    user    none                Off   Sun Mar 28 22:42:59 2010  rite1
    policyname {rite1} sync {yes}
    maxrun 60.000
    action 1.0 puts "Set HostA:"
    action 1.1 gets hosta
    action 1.2 puts "Set HostB:"
    action 1.3 gets hostb
    action 1.4 cli command "enable"
    action 1.5 cli command "config t"
    action 1.6 cli command "ip access-list extended rite1_incoming"
    action 1.7 cli command "no 10"
    action 1.8 cli command "no 20"
    action 1.9 cli command "10 permit ip host $hosta host $hostb"
    action 2.0 cli command "20 permit ip host $hostb host $hosta"
    action 2.1 cli command "ip access-list extended rite1_outgoing"
    action 2.2 cli command "no 10"
    action 2.3 cli command "no 20"
    action 2.4 cli command "10 permit ip host $hosta host $hostb"
    action 2.5 cli command "20 permit ip host $hostb host $hosta"
    action 2.6 cli command "end"
    action 2.7 cli command "show ip access-list | s rite1"
    action 2.8 puts "$_cli_result"
    action 2.9 puts ""
    action 3.1 puts "-------------------------------------"
    action 3.2 puts ""
    action 3.3 puts "Use following packet_capture commands:"
    action 3.4 puts " ritesh - show packet_capture"
    action 3.5 puts " ritecl - clear packet_capture"
    action 3.6 puts " ritestr - start packet_capture"
    action 3.7 puts " ritestp - stop packet_capture"
    action 3.8 puts ""
    action 3.9 puts "-------------------------------------"
    alias exec rite1 event manager run rite1
    Router#rite1
    Set HostA:
    172.20.1.1
    Set HostB:
    20.1.1.1
    Extended IP access list rite1_incoming
        10 permit ip host 172.20.1.1 host 20.1.1.1
        20 permit ip host 20.1.1.1 host 172.20.1.1
    Extended IP access list rite1_outgoing
        10 permit ip host 172.20.1.1 host 20.1.1.1
        20 permit ip host 20.1.1.1 host 172.20.1.1
    Use following packet_capture commands:
    ritesh - show packet_capture
    ritecl - clear packet_capture
    ritestr - start packet_capture
    ritestp - stop packet_capture
    I use this for packet capturing with RITE on remote sites that do not warrant consistent samples. We get alerted when a specific top-talker is showing unusual high volumes of traffic and our techs are able to run the following script on the fly from mobile devices. The high-volume converstaion gets captured and we have another script that exports those onboard captures to centralized servers. The whole operation runs pretty great. The problem is that for some reason it eats a TON of process usage.
    117852: Mar 28 23:03:54.197 DST: %SYS-1-CPURISINGTHRESHOLD: Threshold: Total CPU Utilization(Total/Intr): 72%/1%, Top 3 processes(Pid/Util):  199/71%, 49/0%, 81/0%
    117865: Mar 28 23:04:09.128 DST: %SYS-1-CPUFALLINGTHRESHOLD: Threshold: Total CPU Utilization(Total/Intr) 1%/0%.
    I"m assuming that process # 199 is dynamically created for this specific applet when it runs, as it does not seem to run on the routers at other times:
    Router#show process cpu
    ....output omitted....
    198           0           3          0  0.00%  0.00%  0.00%   0 EEM ED RPC
    201       14371       99291        144  0.00%  0.00%  0.00%   0 DHCPD Receive
    ....output omitted....
    For some reason, while the router is interacting with the user, waiting for input from the "action x.x get" commands, the processer is through the roof. Any ideas on how I could run this similar operation without taking up so much process overhead? I want to say that I could probably limit the resource usage of those specific processes maybe with ERM, but I'm currently not very familiar with ERM. Thanks for everyone's help.

    Joe,
    Thanks so much for converting our applet into a tcl script. It works great everywhere that we have deployed it. We did run into one issue deploying on a 3745 Router with 12.4(15)T9. When the policy was triggered, we received the following error:
    error reading "stdin": Unknown error 134217728
        while executing
    "gets stdin"
        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 "tmpsys:/lib/tcl/base.tcl" line 50)
    Tcl policy execute failed: error reading "stdin": Unknown error 134217728
    Tcl policy execute failed: error reading "stdin": Unknown error 134217728
    I also pulled the specific script that it's referencing the error from:
    # base.tcl - Safe base script forinvoking safe-tcl on FM policies.
    # August 2002, Jason Pfeifer
    # Copyright (c) 2002, 2004-2006 bycisco Systems, Inc.
    # All rights reserved.
    # Current security levels:
    # 0 - trusted script, safe mode not enabled
    # 1 - untrusted script, safe modeenabled
    ####################   Procedures  ##################
    proc TraceVariable { fromInterp fromVartoInterp toVar } {
        set value [ interp eval $fromInterpset ::$fromVar]
        interp eval $toInterp [list set::$toVar $value]
    proc eval_script { slave scriptname } {
        # Open script and evaluate it in slave
        set F [open $scriptname]
        set Contents [read $F]
        close $F
        $slave eval $Contents
    ####################  End of Procedures  ##################
    # main
    # Process argv input:
    set scriptname [lindex $argv 0]
    set security_level [lindex $argv 1]
    if {$security_level != 0 && $security_level != 1} {
        set security_level 1
    #Set Security level specific parameters
    set errorInfo ""
    set FM_TCLLIBDIR [info library]
    if {$security_level == 1} {      #untrusted script
         interp create -safe slave
         interp share {} stdin slave
         interp share {} stdout slave
         interp share {} stderr slave
         lappend global_vars auto_path
         lappend global_vars auto_oldpath
         lappend global_vars tcl_library
         foreach entry [info vars] {
             if [array exists $entry] {
                 continue
             if {[lsearch -exact$global_vars $entry] >= 0} {
                 continue;
             TraceVariable {} $entry slave$entry
         # uncomment to debug safe.tcl
         #::safe::setLogCmd puts stderr
         ::safe::interpInit slave
         # Hidden commands that are exposed to slave to ease restrictions.
         interp alias slave exit {} exit
         interp expose slave fconfigure
         interp expose slave socket
         eval_script slave $scriptname
         close stdin
         close stdout
         close stderr
         ::safe::interpDelete slave
    } else {                          #trusted script
         interp create slave
         interp share {} stdin slave
         interp share {} stdout slave
         interp share {} stderr slave
         foreach entry [info vars] {
             if [array exists $entry] {
                 continue
             TraceVariable {} $entry slave$entry
         if {[catch {::interp eval slave\
                 {source [file join$FM_TCLLIBDIR init.tcl]}} msg]} {
             error "can't sourceinit.tcl into slave ($msg)"
         eval_script slave $scriptname
         interp delete slave
    What ended up happening is the script stayed stuck in pending(no 'scheduler' commands in this early version of eem) and we eventually had to reboot the router(we waited until a regularly scheduled maintenance window, so it worked out fine). Since receiving this error, we haven't tried to run this particular script on this particular router. All other devices that we have deployed this on, including other 3745's running 12.4(15)T, have worked great. If anyone has some idea as to exactly what happened and what adjustments we need to perform to correct the problem, we would greatly appreciate it.
    Thanks again for everyone's help.

  • Reload Router max. once/24 hr while other actions will run all the time within an EEM applet

    I have an EEM script which runs on a track when it goes down, within the actions i have different other things to check and take actions accordingly and they are working fine. I want to include a router reload within the same applet which should only trigger once within 24 hrs., no matter how many times the EEM runs during 24 hrs.
    Here is my current applet:
    event manager applet MyApplet authorization bypass
     event track 10 state down maxrun 3600
     action 1.0 cli command "enable"
     action 2.0 cli command "conf t"
     action 3.0 cli command "service internal"
     action 3.1 cli command "do test cellular 0 modem-power-cycle"
     action 3.2 cli command "no service internal"
     action 4.0 wait 720
     action 5.0 track read 10
     action 6.0 if $_track_state eq "down"
     action 6.1  cli command "int cell0"
     action 6.2  cli command "shut"
     action 6.3  cli command "controller cell 0"
     action 6.4  cli command "lte radio off"
     action 6.5  wait 60
     action 6.6  cli command "no lte radio off"
     action 6.7  cli command "int cell0"
     action 6.8  cli command "no shut"
     action 6.9 end
    At the end i want to add another wait of 10 sec. and check the track state again, if it is still Down I want to trigger a reload, but when router comes back after reload and my EEM triggers again, i don't want to reload if the last reload was triggered within last 24 hrs.

    The way you're using wait in this applet is not ideal.  It would be better, especially for the long wait, to have this broken up into multiple applets so that they can run asynchronously.  In fact, given what you want to do for this reload, that would be the better way to go.  If you configured a second applet at the end of this applet like:
    event manager environment q "
    action 7.0 cli command "event manager applet reload-countdown"
    action 7.1 cli command "event timer countdown 10"
    action 7.2 cli command "action 1.0 cli command enable"
    action 7.3 cli command "action 2.0 cli command $q config t$q"
    action 7.4 cli command "action 3.0 cli command $q no event manager applet reload-countdown$q"
    action 7.5 cli command "action 4.0 cli command end"
    action 7.6 cli command "action 5.0 cli command $q write mem$q"
    action 7.7 cli command "action 1.0 reload"
    Then you could have another applet that reacts to the tracked object coming up.  This applet would simply unconfigure the reload-countdown applet.  Thus, if the track comes back up, the reload will not happen.

  • EEM - puts action fails in EEM applet/script when called via HTTP

    I have an EEM script which produces some diagnostic output.  The script is written to be initiated by "event manager run" and is running in sync mode.  Script uses "puts" into stdout to produce the output.  Everything is working fine, except when script is initiated via HTTP/HTTPS I get no output.
    To reproduce the issue I have created the following applet:
    event manager applet TEST1
    event none sync yes
    action 1 puts nonewline "SOMETEXT"
    Here is output from command line (tested from console and telnet):
    router#event manager run TEST1
    SOMETEXT
    router#
    When applet is called via HTTP using http://router/level/15/exec/-/event/manager/run/TEST1/CR URL the output is empty.  The test message goes to the console versus to HTTP reply.
    So it looks like the stdout is not redirected to HTTP session successfully.
    Any advice on why it is happening, or better yet how to fix it would be apprecaited.

    Thank you.  This is also what I was thinking.  As you probably already know I have opened a TAC case on the matter.

Maybe you are looking for