03-22-2010 09:45 AM
I looking to find a way to do a shut and no shut until the tracking change state. For spoke router using a DHCP connection to the Internet. When there is a problem with the connection, the modem will give a private ip adresse and by just doing a shut and then a no shut it fix the issue but I would like to do it automaticaly. I have already tried with a event manager applet but when the tracking change state it will execute only the commands only once but I would like it to do it every 10 minutes until the tracking change state again. Maybe with tcl script but don't realy know where to start.
Solved! Go to Solution.
03-22-2010 02:17 PM
You can do what you want using three applets (two top-level applets, and one nested applet).
event manager environment quote "
event manager applet track-down
event track 1 state down
action 001 cli command "enable"
action 002 cli command "config t"
action 003 cli command "event manager applet track-timer"
action 004 cli command "event timer watchdog time 180 name track_timer"
action 005 cli command "action 1.0 cli command enable"
action 006 cli command "action 2.0 cli command $quote config t$quote"
action 007 cli command "action 3.0 cli command $quote interface Fa0/0$quote"
action 008 cli command "action 4.0 cli command shut"
action 009 cli command "action 5.0 cli command $quote no shut$quote"
action 010 cli command "action 6.0 cli command end"
event manager applet track-up
event track 1 state up
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "no event manager applet track-timer"
action 4.0 cli command "end"
The above config will periodically shut/no shut interface Fa0/0 every three minutes until the tracked object comes back up.
03-22-2010 01:33 PM
This may be doable with applets. What version of IOS do you have?
03-22-2010 01:47 PM
We use mostly c181x-advipservicesk9-mz.124-15
The only problem I am facing at the moment is that when the tracking state change, it only execute the shut and no shut once but it should do it every X minutes until the tracking state change back. I have tried to change the event with crontab but it doesn't seem to work.
03-22-2010 02:17 PM
You can do what you want using three applets (two top-level applets, and one nested applet).
event manager environment quote "
event manager applet track-down
event track 1 state down
action 001 cli command "enable"
action 002 cli command "config t"
action 003 cli command "event manager applet track-timer"
action 004 cli command "event timer watchdog time 180 name track_timer"
action 005 cli command "action 1.0 cli command enable"
action 006 cli command "action 2.0 cli command $quote config t$quote"
action 007 cli command "action 3.0 cli command $quote interface Fa0/0$quote"
action 008 cli command "action 4.0 cli command shut"
action 009 cli command "action 5.0 cli command $quote no shut$quote"
action 010 cli command "action 6.0 cli command end"
event manager applet track-up
event track 1 state up
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "no event manager applet track-timer"
action 4.0 cli command "end"
The above config will periodically shut/no shut interface Fa0/0 every three minutes until the tracked object comes back up.
03-22-2010 02:45 PM
This is exacly what I was trying to do but I didn't know I could use environnement variables. Thank you so much, it will solve me alot of headache.
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