Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Wed Jul 17, 2019 9:47 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Better? ping.pl script
PostPosted: Thu Mar 22, 2007 12:42 pm 
Offline

Joined: Thu Mar 22, 2007 12:37 pm
Posts: 1
The current ping.pl script for pinging hosts only does one ping. Here is an updated ping.pl script that takes the average ping times over 7 pings. This was tested on Cacti 0.8.6j on FreeBSD 6.0, so milage may vary with other OS's. this is in the cacti/scripts/ping.pl file.

Forgive me if there is a better way to do this in Perl -- I pretty much hacked this as best i could.

#!/usr/bin/perl
open(PROCESS, "/sbin/ping -c 7 $ARGV[0] | grep round-trip |");
$ping = <PROCESS>;
close(PROCESS);
$ping =~ m/(.* = .*\/)(.*)(\/.*\/.*)/;

print $2;


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group