cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4280
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

Joe Clarke
Cisco Employee
Cisco Employee

What version of code does this need to work with?

Hi there,

We have Version 12.4(15)T7

c181x-adventerprisek9-mz.124-15.T7.bin

Thanks for your support!

Okay, so Tcl will be required here. Please provide a flow chart of the process that you want to occur. I've got a good idea of what needs to happen when the problem is first encountered, but I'm not clear exactly what you want to do after the reboot.

Some background on why this is required:

We have found a known issue with the cisco 1811 built in modem where if the router attempts to dial when the phone line has been unplugged or interrupted (SR: 612816679 - a fax or phone is attached to same line) the router will never connect via dial until the router is recycled. We have cleared the line, shut and no shut the dialer and async interfaces and nothing works. ONLY way is to be sure the phone line is plugged into the v.92 port and reload. From there on out it will dial faithfully until the next disconnect on interruption.

Flow - Not sure of all the logic here so please correct as you see fit.

1) Router is up and is tracking three objects - if access to any one object or 2 objects fails - do nothing. If access to all three objects fails - ip sla will kick in delay down timer of 180 seconds. If access to objects recovers before timing out, restore tracking to up and cancel delay down.

2) If delay down timer expires with no object recovery - attempt to dial as normal.

3) Router will round robin between 4 known 800 numbers and if it fails to connect on all 4 tries, reload the router.

4) When router comes back up and tracking still shows down, have it continue to cycle thru the 800 numbers and attempt to dial as it would have done normally but do not reboot again.

5) After a reload and dialup started to work, router should disconnect from dialed 800 number. Reset the reload once script back to a ready state.

Okay, more questions.

1. I assume you already have the IP SLA collector and tracking statements working correctly? A show run would be helpful.

2. No problem here. The policy will trigger off the tracked object which ANDs together the other tracked objects. If that ANDed tracked object goes down, the EEM policy will fire. What commands are required to switch to dial backup?

3. How does one know if all four numbers failed?

4. Once 3 is answered, this is not a problem.

5. No problem.

1. I assume you already have the IP SLA collector and tracking statements working correctly? A show run would be helpful.

Yes, IP Sla works and show run attached :)

2. No problem here. The policy will trigger off the tracked object which ANDs together the other tracked objects. If that ANDed tracked object goes down, the EEM policy will fire. What commands are required to switch to dial backup?

Not sure what you asking here. Interesting traffic is acl 101 and is triggered when an IPsec tunnel needs to be built out the dialer interface and the default route of 0.0.0.0 is now known via this interface (broadband is down)

3. How does one know if all four numbers failed?

See attached file that shows the normal failures. I believe the TTY1: Modem: (unknown)->HANGUP would be an indication that the modem has to be reset.

4. Once 3 is answered, this is not a problem.

5. No problem.

You do not know how much we appreciate this. Thanks Again. We Owe You!

So, nothing really needs to be done to switch to dial backup, right? That is, tracked object 456 will go down, then the DHCP-added route will be dropped, thus making the Dialer route more desirable. The EEM policy should also watch tracked object 456 then.

Will you be leaving debugging enabled forever?

Yes exactly, routes would be removed and 456 down is correct.

Good Point - we would not want to leave debugging on. Can we leave all debugging off and continually do a show dialer to get what you would need to key off of? There will be 4 dial strings a successes column and a Failures column. If the failures column increments 1 higher using the attempted calls dial string, transition thru remaining three strings so you have had all 4 strings increment by one failure and then reboot.

Okay, I'm almost done. I just need to right one more policy to disarm the dial backup watch if the dial backup comes up. What syslog messages do you get when dial backup comes up as it should?

I have attached a file that shows a successfully connected dial session. I believe we can use "Current call connected" string for denoting a successful connection. Will that work?

Okay, these policies should do what you want. They are all untested as I do not have a dial backup setup. First, you need to register the following applets:

event manager applet remove-dial-backup-watch

event syslog pattern "SYS-5-RESTART"

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "no event manager policy tm_check_dial_backup.tcl"

action 4.0 cli command "end"

event manager applet watch-track-down

event track 456 state down

action 1.0 syslog msg "Track 456 is down, waiting to see if dial backup comes up"

action 2.0 cli command "enable"

action 3.0 cli command "config t"

action 4.0 cli command "event manager policy tm_check_dial_backup.tcl"

action 5.0 cli command "end"

event manager applet watch-track-up

event track 456 state up

action 1.0 syslog msg "Track 456 is up, removing dial backup watcher"

action 2.0 cli command "enable"

action 3.0 cli command "config t"

action 4.0 cli command "no event manager policy tm_check_dial_backup.tcl"

action 5.0 cli command "end"

Then, you need to set an environment variable for the Tcl policy:

dial_backup_numbers : Comma-separated list of numbers to check

For example:

event manager environment dial_backup_numbers 18667143757,18003179379,18886601039,18004434603

Then INSTALL but do NOT register the attached Tcl policy. That is, copy the attached Tcl policy to your EEM user policy directory, but do not register it.

Then everything should just work.

Wow! - Awesome!

I will install and test right now and let you know.

Thanks!

I ran a bunch of debugs:

debug event manager, debug dial, debug track, debug ppp nego and got some errors. The router dials as it should in my environment and I am looking to get it to fail to dial while the cable is plugged in so I can see if it will reboot after circulating thru the 4 number strings. See attached for details.

Sorry forgot to attach - here config on the router :)

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: