#!/usr/bin/perl #tnks to Willy @ http://www.willy.com/Scripps/mrtg-data.html for most all of this $ping_str = `/bin/ping -c4 dslreports.com`; # keep only the packets lost $loss = (split(/\,/,$ping_str))[2]; # now $loss looks like " 0%"; # keep only the avg time $avg = (split(/\//,$ping_str))[4]; # now $avg looks like "114.337"; # since we are looking for a positive integer we now round $avg = int($avg); # now return the values along with 2 zero lines. print "$loss\n"; print "$avg\n"; print "0\n"; print "0\n";