cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5221
Views
0
Helpful
52
Replies

EEM script to Reload router 1 Time if Dial Fails

Gerard Roy
Level 2
Level 2

We have a script we use to track objects and if access to these objects fails we reload the router 1 time (see it below). We want to now apply the same script in a different capacity for another customer for dial. If the router fails to connect after trying to round robin thru 4 toll free 800 numbers then reload the router.

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"

Any ideas on how we might accomplish this? I have very little EEM experience :)

1) Current Object tracking tracks 3 objects, If access to all three is down we go into a 180 sec delay down timer. If they remain down we switch over to dial backup.

2) We round robin between 4 dial numbers and if access to all 4 fails, we want to reload router "ONE" time

3) When it comes back up and objects are still unavailable we attempt to dial the 4 numbers again and if it also fails to connect "DO NOT" reload this time.

52 Replies 52

I think that did it.

One more go around with reboots and code rollbacks and I am sure it is resolved Just awesome work. You should get a raise! You have been fantastic.

BTW - You up for another challenge? Take a look at this bug 613172159. I need these 1811's to actualy fail back over to the primary circuit. It is a dual dhcp scenario (2 broadband providers both serving IP's via dhcp). Problem we are seeing is that it fails to fall back to the primary. Looks like the "Fix" doesnt work correctly with object tracking.

Thanks again!

I will give an update shortly.

Hi Joe,

Have a strange issue with the scripting. It only seems to work on sites that obtain their IP address via dhcp. I deployed on 3 statically assigned sites and none of them will do the reboot. Looks like they are stuck in some sort of loop. The dialer never seems to increment in the output when I do a debug event manager all. I have attached a file. Thanks for looking

Yup - for some reason it will not get past the 1st 4 dial attempts. It never increments beyond the 1st 4.

The script is working as designed.  The number of failures is not incrementing in the "show dial" output.  The first time the script runs it sees 1 failure per number.  It stores that value, then continues to run "show dial" until each number has at least one more failure.  Only then will it reload the router.  You need to figure out why the dial backup is no longer trying to dial after one failure.

Joe,

A command we asked Cisco to fix for us that was applied to the routers last year is the culprit on why the static sites would not work with the EEM script (actually all sites since I did not have it applied to my lab router when testing). The command “dialer pre-classify” was created to prevent random IP traffic from causing sites to dial a connection for no apparent reason but now it limits the number of times a single valid IP address will cause the dialup to trigger traffic per dialup number. The script is looking to confirm the router attempted to dial all 4 dial backup numbers and then reboot. With dialer pre-classify it never reaches a point where it sees all 4 numbers attempted.

I have removed the dialer pre-classify command on the sites in question. Now I need to get Cisco to fix the command again

Thank You Sir.

Jerry

Joe,

Can you make a modification for me? Add an event to have the router ping 200.200.200.1. We have a route to this on all our routers out the dial interface to test dial backup (used to confirm modem, line and ppp credentails all work). I noticed when I attempted to ping this address after your script went thru the 4 dial numbers that it finally did the reboot. Looks like the script just needrd the router to attempt to dial 1 more time out the 1st number because it seems to have missed recording of the first dial event when it started tracking it. (does this make any sense?)

I reduced the dial numbers to 2 for another test and sure enough if I ping 200.200.200.1 after it shows it attempted to dial each number once (and no more) then the reboot happens. See attached.

I think this should do what you want.  You will need to set a new environment variable first, though:

event manager environment dial_backup_ip IP

Where IP is the IP address to ping (i.e. 200.200.200.1 in your case).  If the attempt has remained flat, but dial backup is still down, the script will ping the IP, then check again.

Review Cisco Networking for a $25 gift card