ping RTT and packet loss script
Moderators: Developers, Moderators
Yeah, I didn't really explain my problem well.
When I run the script manually it works perfectly.
I created a data input method, which all seems correct:
-script/command
-correct path: perl <path_cacti>/scripts/rtt.pl <count> <host>
- two input fields: count and host
-four output fields: min, avg, max and loss
My data template seems correct:
-data input method is correct
-have four data source items corresponding to the above output fields
I believe my graph template is correct too.
I applied the graph template to the host template (cisco router)
I create the graph, and after five minutes debug says it's okay but no data is being displayed (-1.#J) which I know is okay at first.
Wait 10 to 15 minutes and still nothing.
So I checked the rra file and the rrd for this item has been created but not updated.
It's the only one out of 504 that is not being updated.
I don't understand what I may be missing. It should be getting updated even if I'm sending wrong data or no data.( I think )
It is the only script that I'm running though.
Does that help?
When I run the script manually it works perfectly.
I created a data input method, which all seems correct:
-script/command
-correct path: perl <path_cacti>/scripts/rtt.pl <count> <host>
- two input fields: count and host
-four output fields: min, avg, max and loss
My data template seems correct:
-data input method is correct
-have four data source items corresponding to the above output fields
I believe my graph template is correct too.
I applied the graph template to the host template (cisco router)
I create the graph, and after five minutes debug says it's okay but no data is being displayed (-1.#J) which I know is okay at first.
Wait 10 to 15 minutes and still nothing.
So I checked the rra file and the rrd for this item has been created but not updated.
It's the only one out of 504 that is not being updated.
I don't understand what I may be missing. It should be getting updated even if I'm sending wrong data or no data.( I think )
It is the only script that I'm running though.
Does that help?
maybe you can try to run php.exe c:\inetpub\wwwroot\cacti\cmd.php at the dos command so you can see what values the script is returning. If it says: you know the problem must be at the graph template or something else
Maybe try: rrdtool fetch yourdb.rdd AVERAGE and see the output
Code: Select all
MULTI command: perl c:\apache\htdocs\cacti/scripts/pingavg.pl 195.130.130.4 2, output: min:93 avg:138 max:183 loss:0
MULTI expansion: found fieldid: 37, found rrdname: min, value: 93
MULTI expansion: found fieldid: 38, found rrdname: avg, value: 138
MULTI expansion: found fieldid: 39, found rrdname: max, value: 183
MULTI expansion: found fieldid: 40, found rrdname: loss, value: 0
update c:\Apache\htdocs\cacti/rra/localhost_loss_20.rrd --template min:avg:max:loss N:93:138:183:0
Maybe try: rrdtool fetch yourdb.rdd AVERAGE and see the output
Redhat 9 / Perl script
what I cannot figure out is that on Redhat 9 the last line of ping stats are in the form of:
4 packets transmitted, 4 received, 0% packet loss, time 3006ms
rtt min/avg/max/mdev = 0.442/0.450/0.467/0.018 ms
This causes NONE of the scripts to work, since looking for a value next to min, avg, etc.. does not produce any results. The loss works because it is next to the percent sign...
Am I missing something?
4 packets transmitted, 4 received, 0% packet loss, time 3006ms
rtt min/avg/max/mdev = 0.442/0.450/0.467/0.018 ms
This causes NONE of the scripts to work, since looking for a value next to min, avg, etc.. does not produce any results. The loss works because it is next to the percent sign...
Am I missing something?
Their seems to be a few windows scripts here. I can get mine to work when I run it via comamnd line, but i cant get it to graph??
How do I do it??
#!/usr/bin/perl
$host = $ARGV[1];
$pingcount = $ARGV[0];
$ping = `ping -n $pingcount $host`;
# starts some variables
$min;
$max;
$avg;
$loss;
# check for the minimum value
$ping =~ /Minimum = (\d*)/;
$min = $1;
# check for the maximum value
$ping =~ /Maximum = (.*)ms,/;
$max = $1;
# check for the average value
$ping =~ /(Averag|Gemiddeld)e = (.*)ms/;
$avg = $2;
# check for the % sign inside parens and grab it's value
$ping =~ /(\d*)%/;
$loss = $1;
#print the values
print "min:$min avg:$avg";
How do I do it??
#!/usr/bin/perl
$host = $ARGV[1];
$pingcount = $ARGV[0];
$ping = `ping -n $pingcount $host`;
# starts some variables
$min;
$max;
$avg;
$loss;
# check for the minimum value
$ping =~ /Minimum = (\d*)/;
$min = $1;
# check for the maximum value
$ping =~ /Maximum = (.*)ms,/;
$max = $1;
# check for the average value
$ping =~ /(Averag|Gemiddeld)e = (.*)ms/;
$avg = $2;
# check for the % sign inside parens and grab it's value
$ping =~ /(\d*)%/;
$loss = $1;
#print the values
print "min:$min avg:$avg";
Hi. I want to make this skript work, so when I run at console i see it working. But i read some howto's and do not understand some things ^(. Can someone tell me please what should i do step by step to run any script i wrote on this example with ping?ThyReX wrote:Here is the one i use:
.....
use it like your script: latence.pl <count> <host>
and it return somethink like:....Code: Select all
min:10.766 avg:17.067 max:60.479 dev:14.497 loss:0
thx to my friend TiChou for helping :)
Thank you!
Please help?
Please help me? I can easily write my own script but i can't make it work with cacti, because i do not well understand that to do exactly. Can you show me just one example?
Thank you, i hope you find some minutes to tell me or just give me a link to another article.
Thank you, i hope you find some minutes to tell me or just give me a link to another article.
Who is online
Users browsing this forum: No registered users and 0 guests