Router Script

Unanswered Question
Aug 17th, 2010

Is possible than a router  generate each eight hours a ping to a IP address predefined?

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 3 (1 ratings)
Jason Fraioli Tue, 08/17/2010 - 07:13

Possibly an EEM applet, maybe something like the following.  Check out the link below, it has some great info about this sort of thing.

event manager applet email_server_unreachable

event track 10 state down

action 1.0 syslog msg "Houston we have a problem. Ping failed, server unreachable!"

action 1.1 cli command "enable"

action 1.2 cli command "del /force flash:server_unreachable"

action 1.3 cli command "show clock | append server_unreachable"

action 1.4 cli command "show ip arp | append server_unreachable"

action 1.5 cli command "show ip route | append server_unreachable"

action 1.6 cli command "show interface FastEthernet0/1/1 | append server_unreachable"

action 1.7 cli command "more flash:server_unreachable"

action 1.8 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Server Unreachable: ICMP-Echos Failed" body "$_cli_result"

action 1.9 syslog msg "Server unreachable alert has been sent to email server!"

I copied the info from:

Jason Fraioli Tue, 08/17/2010 - 12:03

You could use TCL and if you have 12.3 IOS (might be 12.4) you can run a kron to kick off the timer.  You are going to have to work out the details on notification of failures, etc, because I am just learning EEM and TCL myself.

TCL: save this code as "ping_ip1.tcl" (or whatever you'd like, just make changes below to reflect the new filename).  Once saved, load into flash, or onto a TFTP server.  If you store anywhere other than flash, be sure to change the IOS kron line below (tclsh tftp/ftp/disk0/etc).

foreach ip {

} {

ping $ip


kron policy-list ping_ip1

tclsh flash:/ping_ip1.tcl

kron occurrence ping_ip1 in 8:0 recurring

policy-list ping_ip1

Edit: See this script for an example of how to get email notifications...


This Discussion