cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1148
Views
3
Helpful
3
Replies

Router Script

ricardorojas123
Level 1
Level 1

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

3 Replies 3

Jason Fraioli
Level 3
Level 3

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 172.16.1.55 | append server_unreachable"

action 1.5 cli command "show ip route 172.16.1.55 | 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: https://learningnetwork.cisco.com/blogs/network-sheriff/2009/06/19/writing-your-first-eem-applet

Thanks Jason,

But, How do I run the TCL file?

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 {
10.0.0.1

10.0.0.2

10.0.0.3

} {

ping $ip
}

IOS:

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... http://forums.cisco.com/eforum/servlet/EEM?page=eem&fn=script&scriptId=2365

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: