Hi,
I am running a modified ping script on Win2k. The script runs fine from the command line, but the Cacti log reports the following error:
11/02/2004 08:40:06 AM - CMDPHP: Poller[0] Host[0] CMD: perl C:\Apache2\htdocs\cacti86/scripts/ping3.pl 2 www.apple.com, output: U
11/02/2004 08:40:06 AM - CMDPHP: Poller[0] Host[0] WARNING: Result from CMD not valid. Partial Result: min:50 avg: 55
I have set the Data Input Method to have min and avg as output fields. I do not see where the issue lies.
Cacti 0.8.6a
Perl 5.8
PHP 4.3.7
Thanks,
brian
Ping script failing
Moderators: Developers, Moderators
- TheWitness
- Developer
- Posts: 17061
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
Brian,
Note the following:
min:50 avg: 55
Get rid of the space between "avg:" and the result "55" on the script output and you will be all set.
TheWitness
Note the following:
min:50 avg: 55
Get rid of the space between "avg:" and the result "55" on the script output and you will be all set.
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Thanks for the reply. I have taken a look at that as it displays fine when run from the command line. Here is the script
#!/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";
Thanks for the help!
#!/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";
Thanks for the help!
It's working now!
The Witness,
Thanks again for the pointer. I got a friend of mine to modify the script and now it works fine. I just need to tweak the graphs now.
Cacti is a great program. Keep up the great work!
brian
Thanks again for the pointer. I got a friend of mine to modify the script and now it works fine. I just need to tweak the graphs now.
Cacti is a great program. Keep up the great work!
brian
modified script
You can force that variable into a number to remove the whitespace from the beginning of it, just add a +0 to the $avg line
$ping =~ /(Averag|Gemiddeld)e = (.*)ms/;
$avg = $2+0;
Thanks for posting!
$ping =~ /(Averag|Gemiddeld)e = (.*)ms/;
$avg = $2+0;
Thanks for posting!
Who is online
Users browsing this forum: No registered users and 2 guests