cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1531
Views
0
Helpful
8
Replies

Pingmon Script Modification Help

Hello Community,

The attached script was created by someone from this community.

I was wondering if someone could take a look at it and let me know if it can be modified to allow multiple ping destinations? Also, can it be modified so as to send a syslog message or and email when the ping isn't successful?

Cheers

Carlton

8 Replies 8

Joe Clarke
Cisco Employee
Cisco Employee

This should do it.  Just list your destinations separated by space in the pingmon_dstip environment variable.

Thank you, thank you.

Going to check it out now. Will let you know how I get on.

Cheers Joseph

Sent from Cisco Technical Support iPad App

So Joseph,

If I want to add multiple ip addresses would I do the following:

event manager environment pingmon_dstip 10.10.13.1 150.50.5.1 170.70.7.1

Also is it possible to just get  syslog message stating pings failed? Or email?

Cheers

Joseph,

I was being a numbty. I didn't fully read what you said - I can add multiple addresses

However, is there a way to email when ping fails?

Cheers

Hi Joseph,

I played around with interval in the environment variables and now I'm getting the following error:

Feb 22 00:01:29.969: %SYS-5-CONFIG_I: Configured from console by en.bcz00513 on vty0 (10.45.32.34)

Feb 22 00:01:52.570: %HA_EM-7-LOG: system:/lib/tcl/eem_scripts_registered/pingmon.tcl: Starting pingmon.tcl...

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl: can't read "errorInfo": no such variable

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl:     while executing

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl: "error $result $errorInfo"

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl:     (procedure "do_ping" line 12)

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl:     invoked from within

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl: "do_ping $filename $interval $dst_ip $repeat $timeout"

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl:     ("foreach" body line 29)

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl:     invoked from within

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl: "foreach dst_ip $pingmon_dstip {

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl: set interval $pingmon_interval

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl: # get ping repeat if not exist we use no repeats

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl: set repeat     [ expr { [info exists ..."

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl:     invoked from within

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl: "$slave eval $Contents"

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl:     (procedure "eval_script" line 7)

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl:     invoked from within

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl: "eval_script slave $scriptname"

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl:     invoked from within

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl: "if {$security_level == 1} {       #untrusted script

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl:      interp create -safe slave

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl:      interp share {} stdout slave

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl:      interp share {} stderr slave..."

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl:     (file "system:/lib/tcl/base.tcl" line 50)

Feb 22 00:01:52.586: %HA_EM-6-LOG: pingmon.tcl: Tcl policy execute failed: can't read "errorInfo": no such variable

The variables I changed are:

event manager environment pingmon_dstip 79.xx.xx.xx 81.xx.xx.xx

event manager environment pingmon_repeat 5

event manager environment pingmon_timeout 1

event manager environment pingmon_interval 10

event manager directory user policy flash:/

event manager policy pingmon.tcl type user

Appreciate your help

Cheers

Try this version.

Joesph

Thanks for the update

I just want to get your opinion on what my intentions are with the script.

I'm intend on adding over 50 ip addresses to the variable, is that good practice? Can you think of a more efficient way to add such large number of ip addresses?

Cheers mate

Sent from Cisco Technical Support iPad App

You could get this script to ping 50 addresses.  What you'd need to at the very least, though, is adjust the maxrun timer to take into account your ping timers.  For example, with the timers above you should set your maxrun to 800.