12-14-2011 09:33 AM
I'm not sure this is the right sub-community to post this kind of question. But one of search results for "EEM" led me here. If this is not the right spot, please point me to where I'm supposed to be.
Anyway...
We use EEM applets to shut down/no shut one of FastEth interfaces on a c877/871(12.4(24)T1) by tracking IP SLA reachability over the main WAN circuit(ADSL or FE4 Ethernet) to let the another box (FortiGate 50B) know the main circuit is down and let it dial-out to the backup modem. This works fine when the circuit goes down and come back up while the c87x is in normal operation. However, when we or the cutomer on-site power-cycle the route while the circuit is down, the tracking object stays in "DOWN" state and doesn't change "UP"->"DOWN", it doesn't trigger the DOWN-applet to let the FG50B dial out.
As a temporary measure, we configured the interface to be "SHUT" and save the config so that every time it got booted up it start with the "DOWN" condition and when the circuit comes up the UP-applet gets triggered by "DOWN"->"UP" state change. A problem with this measure is if someone, likely one of our techs, needs to change the config in the router for whatever the reason, that person needs to remember that he/she need to shut down the monitoring interface down before saving it and reload the router to get back into a normal operation mode.
My question is if there is any way to trigger the applet a little after it boots up based on the state of a tracking object, not by a change of the state.
The key config for this arrangement in an 877 is below.
Thanks,
Toshi
############
track 1 ip sla 1 reachability
delay down 30 up 60
!
ip sla 1
icmp-echo <GW-IP> source-ip <Interface IP on ATM0.1>
frequency 30
ip sla schedule 1 life forever start-time now
!
event manager environment ShutdownHB FastEthernet2
event manager applet ShutdownInterface
event track 1 state down
action 0 cli command "enable"
action 1 cli command "config t"
action 2 cli command "interface $ShutdownHB"
action 3 cli command "shutdown"
action 4 cli command "end"
event manager applet EnableInterface
event track 1 state up
action 0 cli command "enable"
action 1 cli command "config t"
action 2 cli command "interface $ShutdownHB"
action 3 cli command "no shutdown"
action 4 cli command "end"
!
12-14-2011 09:57 AM
I know virtually nothing about EEM.but I've seen that you have access to SNMP objects so you can monitor the sysuptime variable for this.
Cheers,
Michel
12-14-2011 10:15 AM
Michel,
Are you suggesting I should set up an applet to be triggered by two events, 1) IP SLA down, AND 2) sysuptime= 1min or so, to shut down FE2 interface?
I'm currently looking for how to code this kind of combination triggering if there is no simple&easy fix for this.
12-14-2011 11:07 AM
If you feel the script should run when the device is just rebooted then uptime is what you should monitor.
Find more about EEM here:
https://supportforums.cisco.com/docs/DOC-12757
Cheers,
12-14-2011 11:13 AM
I'll read through the document, but no, only another condition: state of IP SLA is down was met it should run the applet after the reboot.
Toshi
12-14-2011 04:34 PM
Have a look at https://supportforums.cisco.com/docs/DOC-12612. This document explains some ways to execute an EEM policy at boot time. If you're using EEM 2.4 or higher, you can tie another event to your policy to run at boot time. For example:
event manager applet ShutdownInterface
event tag e1
timer countdown time 10
event tag e2 track state down
trigger
correlate event e1 or event e2
...
12-14-2011 04:42 PM
Thanks, I'll take a look at it too. But I guess I need to run a script when it boots up to check the track state is still down. "event tag e2 track state down" doesn't become an event unless the state changes from up to down. And I need to use "AND" logic between e1 and e2.
Toshi
12-14-2011 04:53 PM
I assumed you wanted to fire and forget the down policy. If you're running EEM 3.0 or higher, you could do this:
event manager applet ShutdownInterface
event tag e1 track 1 state down
event tag e2 countdown time 10
trigger
correlate event e1 or event e2
action 0 track read 1
action 1 if $_track_state eq "down"
action 2 cli command "enable"
action 3 cli command "config t"
action 4 cli command "interface $ShutdownHB"
action 5 cli command "shutdown"
action 6 cli command "end"
action 7 end
12-14-2011 05:09 PM
Sounds like that's exactly what I wanted to do. I'll test it and let you know if it works.
Thanks!
Toshi
12-14-2011 05:44 PM
Even though it's EEM v3.0, it doesn't seem to take tag names. I tried a longer name but ended with the same error. Any idea?
Router#sh event manager version
Embedded Event Manager Version 3.00
Component Versions:
eem: (v300_throttle)2.2.19
eem-gold: (v300_throttle)1.0.15
eem-call-home: (v300_throttle)2.0.4
Router# config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#event manager applet ShutdownInterface
Router(config-applet)#event tag e1 track 1 state down
%EEM: Error all multiple event entries require a tagname
Router(config-applet)#event tag e2 timer countdown time 60
%EEM: Error all multiple event entries require a tagname
Toshi
12-14-2011 10:15 PM
You need to remove your existing event configurations. That is, you need to do this first:
no event track 1 state down
12-15-2011 08:57 AM
Yes, it work! I need to adjust the timer value in relation to track delay timer but even if it runs prematually, the other aplet would correct the status anyway. So it shouldn't be a big problem.
Thank you for your help, Joseph. I'll test more about condistional expressions to tune this applet. But if it gets too complicated, I probably would go to a TCL script.
Toshi
09-17-2021 05:51 AM
The link is now How To Run an EEM Policy Every Time a Device Boots .
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide