[mrtg] Re: Ping Latency script from Kevin Nassery reworked(downlo ad page)

Adam Augustine adam_augustine at morinda.com
Mon Oct 30 17:31:15 MET 2000


Since others are posting their modifications I guess I will too.

Below is a context diff from my modified version of the pinged.pl script. It
runs a bit faster (half the time) since it only has to run the ping once
instead of twice. It also makes it slightly more portable since you don't
have to have to grep.

I don't have the resources to test it on any platforms other than Linux at
this time, but I am pretty sure it should work without any problems (at
least any new problems:-)).

Have fun,
	Adam

*** pinged.pl	Fri Oct 27 01:59:40 2000
--- newpinged.pl	Fri Oct 27 17:07:08 2000
***************
*** 20,37 ****
  
  # On Solaris
  # 10
! # $result = `ping -sn $host 64 10|/usr/xpg4/bin/grep -e round-trip`;
! # $result2 = `ping -sn $host 64 10|/usr/xpg4/bin/grep -e packet`;
  
  # On linux
! $result = `ping -c 25 $host|grep -e round-trip`;
! $result2 = `ping -c 25 $host|grep -e packet`;
  
  # on windows
  # still on to do list have various problems there :(
  # 20
! # $result = `ping -n 25 -l 64 $host | grep -e round-trip`;
! # $result2 = `ping -n 25 -l 64 $host | grep -e packet`;
  
  # splits the results in to usable packages
  @response = split(/ /, $result);
--- 20,45 ----
  
  # On Solaris
  # 10
! # $options = "-sn $host 64 10";
  
  # On linux
! $options = "-c 25 $host ";
  
  # on windows
  # still on to do list have various problems there :(
  # 20
! # $options = "-n 25 -l 64 $host";
! 
! open(PINGCHECK, "ping $options |");
! while(<PINGCHECK>) {
!         if (/round-trip/) {
!                 $result=$_;
!         }
!         elsif (/packet/) {
!                 $result2=$_;
!         }
! }
! close(PINGCHECK);
  
  # splits the results in to usable packages
  @response = split(/ /, $result);

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list