09-16-2016 06:03 AM
Is there a way to stop a running event?
I would reload the router in case of connectivity issues, but give you the chance to stop the reload if you're working on it.
fe:
event manager applet Reload-on-vpn-failure
event track 33 state down
action 1.0 syslog msg "No remote servers seen for a while"
action 1.1 syslog msg "Will reload in 60 seconds"
action 1.2 syslog msg "Cancel this reload with XXX"
action 1.3 wait 60
action 1.4 cli command "enable"
action 1.5 reload
Solved! Go to Solution.
09-18-2016 09:10 AM
First, this applet will not work as written since it will timeout after 20 seconds of waiting. You'd need to increase the maxrun to something like 70 or 80 for this to work. Second, you don't need action 1.4.
To stop this applet, you can run the command "event manager scheduler clear ID" or "... clear all". That said, it will not immediately abort. It should abort after the wait before the reload.
But I wouldn't use this approach. I'd use three applets with nesting:
event manager applet check-vpn-failure
event track 33 state down
action 1.0 syslog msg "No remote servers seen for a while"
action 1.1 syslog msg "Will reload in 60 seconds"
action 1.2 syslog msg "Cancel this reload with 'vpn reload cancel'"
action 1.3 cli command "enable"
action 1.4 cli command "config t"
action 1.5 cli command "event manager applet Reload-on-vpn-failure"
action 1.6 cli command "event countdown time 60"
action 1.7 cli command "action 1.0 reload"
action 1.8 cli command "end"
!
event manager applet abort-reload
event cli pattern "^vpn reload cancel" enter
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "no event manager applet Reload-on-vpn-failure"
action 4.0 cli command "end"
09-18-2016 09:10 AM
First, this applet will not work as written since it will timeout after 20 seconds of waiting. You'd need to increase the maxrun to something like 70 or 80 for this to work. Second, you don't need action 1.4.
To stop this applet, you can run the command "event manager scheduler clear ID" or "... clear all". That said, it will not immediately abort. It should abort after the wait before the reload.
But I wouldn't use this approach. I'd use three applets with nesting:
event manager applet check-vpn-failure
event track 33 state down
action 1.0 syslog msg "No remote servers seen for a while"
action 1.1 syslog msg "Will reload in 60 seconds"
action 1.2 syslog msg "Cancel this reload with 'vpn reload cancel'"
action 1.3 cli command "enable"
action 1.4 cli command "config t"
action 1.5 cli command "event manager applet Reload-on-vpn-failure"
action 1.6 cli command "event countdown time 60"
action 1.7 cli command "action 1.0 reload"
action 1.8 cli command "end"
!
event manager applet abort-reload
event cli pattern "^vpn reload cancel" enter
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "no event manager applet Reload-on-vpn-failure"
action 4.0 cli command "end"
09-18-2016 09:52 PM
Thanks already for your response, I'll try it today!
Didn't know the 'cli pattern' event. Open doors for extra stuff. ;)
You wrote about the maxrun, where can/must I change this? It's not a (clear) action... :$
09-18-2016 10:06 PM
The maxrun parameter is an argument to the event detector line.
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