Remote ping from Cisco routers

Templates, scripts for templates, scripts and requests for templates.

Moderators: Moderators, Developers

Post Reply
Author
Message
User avatar
bulek
Cacti Pro User
Posts: 854
Joined: Mon May 20, 2002 2:07 am
Location: Poland
Contact:

Remote ping from Cisco routers

#1 Post by bulek » Mon May 20, 2002 5:43 am

Hi,

I was looking for a command line tool that can measure latency using remote ping feature of Cisco routers. I found a suitable perl script:

http://www.marmoset.net/~knail1/scripts ... rping.html

After downloading to scripts/ I created the following "Data Input":

Input String: perl <path_cacti>/scripts/rping -c <community> <srcIP> <dstIP> | grep round-trip | cut -d' ' -f10
Output String: <min>/<avg>/<max>

It works well for me... it's nice to have link latency along with utilization. After small modification of "Input String" definition you can get some more info like success rate. Community name used has to be of course read-write one.

The drawback is speed. It takes time to setup ping session on the router and read the results.

Let me know if you are aware of similar scripts/tools.

Guest

#2 Post by Guest » Thu Mar 13, 2003 8:36 pm

Hey Bulek can you post what you did step by setup here? I can;t seem to get it working. Everytime i enter all the info into cacti, i get Mysql issues.

thanks!

User avatar
bulek
Cacti Pro User
Posts: 854
Joined: Mon May 20, 2002 2:07 am
Location: Poland
Contact:

#3 Post by bulek » Fri Mar 14, 2003 5:59 am

As far as I remember this should be done as follows:

1. Check if the script works for you from command line. The example session looks like this:
[[email protected] root]# perl /var/www/html/cacti/scripts/rping -c my_rw_community 10.1.1.2 10.1.1.5 | grep round-trip | cut -d' ' -f10
1/2/4
2. Create new Data Input script according to my hints in first mail.

3. Create Data Source and select in Data Input Type your new Data Input. Use GAUGE as a DS type. This should create a data source with sub DS-es.

4. Then Graph with data items coresponding to new sub DS-es.

If you have mysql problem then maybe something elase is wrong.

- bulek

Guest

#4 Post by Guest » Sat Mar 15, 2003 12:17 pm

Thanks! I think i almost got it working! See the only reason that i mentioned the MySQL issues, was that when i attempted to add the DS etc. and then ran from the command line (cmd.php), i got this

Code: Select all

[[email protected] scripts]# php /var/www/html/cacti/cmd.php
X-Powered-By: PHP/4.1.2
Content-type: text/html

<br>
<b>Warning</b>:  Unable to jump to row 0 on MySQL result index 341 in <b>/var/www/html/cacti/cmd.php</b> on line <b>147</b><br>
<br>
<b>Warning</b>:  Supplied argument is not a valid MySQL result resource in <b>/var/www/html/cacti/cmd.php</b> on line <b>150</b><br>
<br>
<b>Warning</b>:  Unable to jump to row 0 on MySQL result index 341 in <b>/var/www/html/cacti/cmd.php</b> on line <b>157</b><br>
<br>
<b>Warning</b>:  Unable to jump to row 0 on MySQL result index 342 in <b>/var/www/html/cacti/cmd.php</b> on line <b>147</b><br>
<br>
<b>Warning</b>:  Supplied argument is not a valid MySQL result resource in <b>/var/www/html/cacti/cmd.php</b> on line <b>150</b><br>
<br>
<b>Warning</b>:  Unable to jump to row 0 on MySQL result index 342 in <b>/var/www/html/cacti/cmd.php</b> on line <b>157</b><br>
<br>
<b>Warning</b>:  Unable to jump to row 0 on MySQL result index 343 in <b>/var/www/html/cacti/cmd.php</b> on line <b>147</b><br>
<br>
<b>Warning</b>:  Supplied argument is not a valid MySQL result resource in <b>/var/www/html/cacti/cmd.php</b> on line <b>150</b><br>
<br>
<b>Warning</b>:  Unable to jump to row 0 on MySQL result index 343 in <b>/var/www/html/cacti/cmd.php</b> on line <b>157</b><br>
One more question, and i think this is where im getting hung up at. What is the output data-source? Right now i have it set at

Code: Select all

"min/avg/max"?
I have all the input feilds working well...but the output?

Thanks again for your help!!

User avatar
bulek
Cacti Pro User
Posts: 854
Joined: Mon May 20, 2002 2:07 am
Location: Poland
Contact:

#5 Post by bulek » Sat Mar 15, 2003 2:24 pm

Once again... my Data Input looks like this:
Name: The name of this data source; only used by the front end.
Remote Ping (SNMP)
Input String: The data that in sent; which includes the filename and input sources in <> brackets.
perl <path_cacti>/scripts/rping -c <community> <srcIP> <dstIP> | grep round-trip | cut -d' ' -f10
Output String: The data that is returned from the input program; defined as <> brackets.
<min>/<avg>/<max>

Save

Current Data Input Source Fields Add
Name Data Name Input/Output Update RRA
Avg avg Output Yes Remove
Community name community Input No Remove
Destination IP address dstIP Input No Remove
Max max Output Yes Remove
Min min Output Yes Remove
Source IP address srcIP Input No Remove


I think you may have problems with your crontab user. The script uses some external tools like perl, grep and cut. Quite often PATH is set with minimal config and it is posiible that some of mentioned tools can not be found. The same command may work very good from command line. Try to find location of these three tools and update your PATH settings in crontab.

- bulek

kkinderen
Posts: 25
Joined: Sun Dec 21, 2003 11:48 pm
Location: Wolfsville, MD
Contact:

#6 Post by kkinderen » Wed Jan 07, 2004 6:46 pm

I'm interested in getting this running for 6 routers but have a couple (3) of problems.

1) Seems this was done on an earlier version of Cacti. There is no place for Output String in the Data Input Method.

2) On the input string, I can't add anything after the -d. Says it's an invalid URL. Do I have to quote it or something?

3) The output (if I could get the input method working) has the format 88/90/96. How do I get that into an RRA?

Help?

Kevin

User avatar
bulek
Cacti Pro User
Posts: 854
Joined: Mon May 20, 2002 2:07 am
Location: Poland
Contact:

#7 Post by bulek » Thu Jan 08, 2004 7:12 am

You are right... it was for previous version of cacti. Since I still don't spend too much time with new version I can't say what to change in my old solution.

I think however you can achieve the same goal using Cisco SSA agent built in into IOS. Out of the box solution for newest cacti is described here: http://www.raxnet.net/board/viewtopic.php?t=2807

- Piotr

Post Reply