cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2046
Views
0
Helpful
3
Replies

EEMScript: Need to invoke after an event at a specific time

sfallison
Level 1
Level 1

Hi.

I need to somehow if possible create an applet that will run at a specific time once an event has occured.

If my router Serial goes down, I want the router to switch over to the Secondary Router (HSRP) and have the Primary router change it's HSRP Standby 1 priority from 110 to 95.  This way, the Secondary will remain active even if the Primary Serial comes back up (Have a problem with them bouncing).

Using a Test Router, I substituted L2 for my Serial:

event manager applet L2_Down

event syslog pattern "LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback2, changed state to down"

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.1 cli command "interface fastethernet 0/1"

action 3.2 cli command "standby 1 priority 95"

action 3.5 cli command "end"

action 4.0 syslog msg " Int FE0/1 Priority Changed. Restore with Carlson OK"

This works great!

On the circuit comming up, I can restore two ways:

Trigger on L2 Up:

vent manager applet L2_Up

event syslog pattern "LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback2, changed state to up"

or use CRON:

event timer cron name Restore_Standby_1 cron-entry "00 02 * * *"

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.1 cli command "interface fastethernet 0/1"

action 3.2 cli command "standby 1 priority 110"

action 3.5 cli command "end"

action 4.0 syslog msg " Int FE0/1 Priority restored to normal"

What I am looking for is somehow to trigger off both events:

L2 state to UP, and do not invoke until Sunday 2 am.

Using CRON, the router will invoke the applet every Sunday at 2am. If my circuit is still down, then the router will switch over (HSRP should kick back, but the L2_Down applet won't run.. so I am in the original problem with a bouncing circuit.

3 Replies 3

avayner
Level 1
Level 1

Hi,

The trick I use for this kind of requirements is to use stub tracking objects.

So you can create a tracking object that would "remember" that you need to fail back to the primary.

So when the link comes back up you can set the track object to up, and check its state in the script.

In the recovery script you set it back to down.

So something like this:

track 1 stub-object

default-state down

event manager applet L2_Up

event syslog pattern "LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback2, changed state to up"

action 1.0 track set 1 state up

event manager applet TIMER-RESTORE

event tag TIMER timer cron name Restore_Standby_1 cron-entry "00 02 * * *"

trigger

  correlate event TIMER and track 1

action 9.0 track set 1 state down

Another thing you can do is a manual restore trigger:

event manager applet MANUAL-RESTORE

event none

action 1.0 track read 1

action 2.0 if $_track_state eq down

action 2.1  puts "uplink interface is down, can't recover"

action 3.0 else

action 4.1  syslog msg "recovery code goes here"

action 5.0 end

alias exec recover event manager run MANUAL-RESTORE

HTH

Arie

I am using a Cisco 1841 (c1841-spservicesk9-mz.124-19b.bin) for a test unit..  

default-state down is not a command for this router /IOS.  I can only do defalut delay.

R1#(config-applet)#event ?

  application  Application specific event

  cli          CLI event

  counter      Counter event

  interface    Interface event

  ioswdsysmon  IOS WDSysMon event

  none         Manually run policy event

  oir          OIR event

  snmp         SNMP event

  syslog       Syslog event

  timer        Timer event

Yeah, you would need a newer IOS for that...

Not sure this is the best approach, but you could have the script that detects the link going up also provision the recovery script (the one that has the cron).

The link down event can make sure the script is removed...

(basiclaly using "action cli", you can configure and unconfigure the EEM applet)

Review Cisco Networking for a $25 gift card