cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
7636
Views
15
Helpful
12
Replies

Triggering EEM applet after reload/powerup

toshi-esumi
Level 1
Level 1

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 Replies 12

Michel Hegeraat
Level 7
Level 7

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 

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.

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,

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

Joe Clarke
Cisco Employee
Cisco Employee

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

...

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

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

Sounds like that's exactly what I wanted to do. I'll test it and let you know if it works.

Thanks!

Toshi

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

You need to remove your existing event configurations.  That is, you need to do this first:

no event track 1 state down

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

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: