my $p = Net::Ping->new("icmp",$timeout,32); while (1) { foreach my $host (@hosts) { my @times; for (1..4) { my $t0 = [gettimeofday]; my $alive = $p->ping($host); my $t1 = tv_interval ($t0, [gettimeofday]); push @times, $alive ? # was ping successful? int($t1 * 1000) : # if so, record interval $timeout * 1000; # if not, record timeout val } my ($sec, $min, $hr, $day, $month, $year) = (localtime)[0..5]; my $timestamp = sprintf("%04d-%02d-%02d,%02d:%02d:%02d", $year + 1900, $month + 1, $day, $hr, $min, $sec); print "$timestamp,$host,", join ( ',', @times ), "\n"; } sleep $yawn; } #### 2003-08-15,17:02:19,10.10.10.50,62,46,62,46 2003-08-15,17:02:20,10.10.10.60,109,46,62,62 2003-08-15,17:02:20,10.10.10.70,93,62,46,62 2003-08-15,17:02:20,10.10.10.80,109,62,46,62 2003-08-15,17:02:21,10.10.10.90,93,62,62,46 2003-08-15,17:02:23,10.10.10.50,46,62,46,62 2003-08-15,17:02:23,10.10.10.60,46,62,62,62 2003-08-15,17:02:23,10.10.10.70,46,62,46,62 2003-08-15,17:02:23,10.10.10.80,62,46,62,46 2003-08-15,17:02:24,10.10.10.90,62,62,46,62 #### 2003-08-15,17:11:04,10.10.10.50,46,62,46,46 2003-08-15,17:11:04,10.10.10.60,62,62,46,62 2003-08-15,17:11:05,10.10.10.70,62,62,46,62 2003-08-15,17:11:05,10.10.10.80,46,62,62,46 2003-08-15,17:11:05,10.10.10.90,62,46,62,62 2003-08-15,17:11:07,10.10.10.60,2003-08-15,17:11:08,10.10.10.70,2003-08-15,17:11:08,10.10.10.80,2003-08-15,17:11:08,10.10.10.90,2003-08-15,17:11:11,10.10.10.50,2003-08-15,17:11:11,10.10.10.60,2003-08-15,17:11:11,10.10.10.70,2003-08-15,17:11:11,10.10.10.80,2003-08-15,17:11:12,10.10.10.90,