cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3690
Views
0
Helpful
4
Replies

EEM Script to reload router only once after tracked object is down.

Gerard Roy
Level 2
Level 2

event manager applet vpn_tunnel_unreachable

event track 456 state down

action 1.0 reload

I need it to reload only once if tracked object 456 is down. It should reload the router and then if the tracked object is still down it should go into dial backup as it normally would if it did not have the reload script.

4 Replies 4

Joe Clarke
Cisco Employee
Cisco Employee

You could do this with one applet which configures the other:

event manager environment quote "

event manager applet vpn_tunnel_up

event track 456 state up

action 001 cli command "enable"

action 002 cli command "config t"

action 003 cli command "event manager applet vpn_tunnel_unreachable"

action 004 cli command "event track 456 state down"

action 005 cli command "action 1.0 cli command "$quote enable$quote"

action 006 cli command "action 2.0 cli command "$quote config t$quote"

action 007 cli command "action 3.0 cli command $quote no event manager applet vpn_tunnel_unreachable$quote"

action 008 cli command "action 4.0 cli command $quote end$quote"

action 009 cli command "action 5.0 cli command $quote "write mem$quote"

action 010 cli command "action 6.0 reload"

action 011 cli command "end"

When the tracked object transitions from down to up, it will configure the down applet. Before the reload, the down applet will unconfigure itself, then save the running config.

Of course, I had three typos here. I added extra quotes. There is also something to be aware of when using later versions of IOS. You can no longer unconfigure a policy while it's running. Instead, you'll need another permanent applet to do the reboot and unconfigure. Here are two applets which should work with EEM 2.2 and higher:

event manager applet vpn_tunnel_rebooter

event none

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "no event manager applet vpn_tunnel_unreachable"

action 4.0 cli command "end"

action 5.0 cli command "write mem"

action 6.0 reload

event manager applet vpn_tunnel_up

event track 456 state up

action 001 cli command "enable"

action 002 cli command "config t"

action 003 cli command "event manager applet vpn_tunnel_unreachable"

action 004 cli command "event track 456 state down"

action 005 cli command "action 1.0 policy vpn_tunnel_rebooter"

action 006 cli command "end"

What you wrote immediatly above works good but do I use it in combination with my original script? I need to take this to the next level. We are having the following issue. Cisco has set the administrative distance (AD) for IP's assigned via dhcp to be 254. If we have a site go out and it has 2 dhcp circuits it receives an IP on each interface and sets the path for data traffic to be out the interface that has object tracking applied. If object tracking fails the router will fail over to the secondary dhcp circuit correctly. The issue arises that when object tracking comes back on line because the primary circuit is back up the router sees in the routing table an equal AD and does not consider the primary link a better path so it never switches back over. New IOS code will be released end of September (possibly) that resolves routing issues with sites that have dual Dhcp circuits assigned by allowing us to set an AD on a per interface basis. In the interim we can reboot the routers when we come across a site that is experiencing this issue. can we set these to reboot on a schedule with EEM?

No, these two policies replace your original policy.

Sure, you can schedule a reload. For example, to reboot every 24 hours:

event manager applet schedule-reboot

event timer watchdog time 86400

action 1.0 reload

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: