06-29-2011 04:44 AM - edited 03-04-2019 12:50 PM
Can someone help me with a EEM configuration that would reset an interface on the router and force a re-dhcp when connectivity is lost to an upstream router? I would like the applet to run every 15 minutes. I am thinking of an event that is triggered to do a shut/no shut on the interface when 5 pings are lost.
Thanks in advance
Jon
06-29-2011 05:43 AM
This is a simple thing - you just need the EEM script to look for the syslog event of an IP SLA monitor to alert of 5 dropped pings, nothing major.
However - you could also just write the simple EEM script to shut and open the interface, and attach the EEM script to a kron schedule that runs every 15 minutes....... or both!!!!
06-29-2011 02:39 PM
Thanks for your reply. Conceptually I know exactly what you are talking about. I cannot figure out the commands. Can the cron schedule be written to only schedule the interface reset based on the 5 missed pings? What is the cron command format for every 15 minutes? This is what I tried but was causing a constant interface reset:
event manager applet redhcp
event tag 1.0 cli pattern "ping 192.168.1.1" sync yes occurs 32 period 60 maxrun 60
event tag 2.0 syslog pattern "..."
trigger occurs 1 delay 50
correlate event 1.0 or event 2.0
attribute tag 1.0 occurs 1
attribute tag 2.0 occurs 1
action 1.0 cli command "enable"
action 2.0 cli command "config terminal"
action 4.0 cli command "interface fastethernet 4"
action 5.0 cli command "shutdown"
action 6.0 cli command "no shutdown"
action 91.0 cli command "exit"
action 99.0 cli command "show run interface fastethernet 4"
06-29-2011 03:14 PM
Try - this runs every 15 mins...
kron occurrence <
policy-list <
kron policy-list <
cli event manager run <
event manager applet << EEM NAME 1>>
event none
action 1.0 cli command "enable"
action 1.1 cli command "conf t"
action 1.2 cli command "interface <
action 1.3 cli command "shut"
action 1.4 cli command "end"
action 1.5 syslog msg "*** EEM has closed <
exit
event manager applet <
event syslog pattern "%LINEPROTO-5-UPDOWN: Line protocol on Interface <
action 1.0 cli command "enable"
action 1.1 cli command "conf t"
action 1.2 cli command "interface <
action 1.3 cli command "no shut"
action 1.4 cli command "end"
action 1.5 syslog msg "*** EEM has opened <
exit
06-29-2011 03:25 PM
Andrew, Thanks.
How do you get these two applets to trigger based on the 5 missed pings and stop when reachability returns? Do I need an IP SLA?
06-30-2011 01:31 AM
Yes - the posted runs every 15 mins. if you don't want that anymore, then configure an IP SLA, then trigger on the syslog IP SLA down log event - is the easyiest way.
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