Remote ping from Cisco routers

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

Moderators: Developers, Moderators

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

Remote ping from Cisco routers

Post by bulek »

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

Post by Guest »

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:

Post by bulek »

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:
[root@nms 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

Post by Guest »

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

[root@houdini 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:

Post by bulek »

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:

Post by kkinderen »

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:

Post by bulek »

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

Who is online

Users browsing this forum: No registered users and 3 guests