12-17-2012 07:03 PM
We are using EEM to increase OSPF cost on primary link if OSPF flaps a couple of times in 5-minutes or IPS SLA detects an issue. The traffic then uses an alternate link until OSPF cost is retutned to normal.
Now we want to automate restoring OSPF cost to normal a couple of hours after last OSPF flap or IP SLA event. Notice I said 'last' so if link is faulty for several hours we do not want to restore OSPF cost until it has been stable for a period of time.
Need suggestions on how to setup a timer so that is can be reset if link flaps again before it has timed out?
Thanks
Peter
Solved! Go to Solution.
12-20-2012 09:05 AM
No, you have to create the timer applet from within your "up" applet.
event manager environment q "
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "event manager applet OSPFCOSTTIMER"
action 4.0 cli command "event timer countdown time 300"
action 5.0 cli command "action 1.0 syslog msg $q OSPF COST RESTORE TIMER TEST$q"
action 6.0 cli command "end"
12-19-2012 01:47 AM
This is typically simpler than you might think. Have the policy that detects the IPSLA "up" event install a timer countdown policy that counts down the desired number of "stable" seconds. If that timer is allowed to get to zero, then the link is restored. If, however, you have another flap, have your "down" event remove that countdown timer policy. Thus the link will not be restored.
12-19-2012 09:37 PM
Thanks Joseph. Your solution sounds great.
I cannot work out how to install a timer countdown policy. On a test router tried:
event manager applet OSPFCOSTTIMER
description OSPF RESTORE COST TIMER
event timer countdown name TIMER time 300
action 1.0 syslog msg "OSPF COST RESTORE TIMER TEST"
event manager applet OSPFUP
description OSPF UP
event..... (trigger on OSPF UP)
action 1.0 policy OSPFCOSTTIMER
But OSPFUP get an error executing statement 1.0. I have not done much EEM so guess I am doing it wrong.
Also, how do I remove the countdown (OSPFCOSTTIMER) policy for an OSPF down?
12-20-2012 09:05 AM
No, you have to create the timer applet from within your "up" applet.
event manager environment q "
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "event manager applet OSPFCOSTTIMER"
action 4.0 cli command "event timer countdown time 300"
action 5.0 cli command "action 1.0 syslog msg $q OSPF COST RESTORE TIMER TEST$q"
action 6.0 cli command "end"
12-20-2012 07:11 PM
Excellent. Thanks for your help.
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