--- lib/PXElator/ping.pm 2009/08/28 23:30:38 334 +++ lib/PXElator/ping.pm 2009/08/30 17:24:19 381 @@ -7,9 +7,12 @@ use Data::Dump qw/dump/; use Time::HiRes; use client; +use CouchDB; sub host { - Net::Ping->new->ping( shift, 0.7 ); + my $ip = shift; + my $status = fping($ip); + defined $status->{$ip}; } sub fping { @@ -24,16 +27,17 @@ if ( $ret ) { $syn{$host} = $ip; -# $status->{dns}->{$ip} = $nslookup_duration * 1000; } else { push @{ $status->{address_not_found} }, $host; } } while (my ($host,$rtt,$ip) = $p->ack) { - $status->{$ip}->{rtt} = $rtt * 1000; # ms warn "# $host $rtt $ip\n"; + $rtt *= 1000; # ms client::conf( $ip => 'hostname', default => $host ) if $host ne $ip; + $status->{$host} = { host => $host, rtt => $rtt, ip => $ip }; + CouchDB::audit( $ip, $status->{$host}); } warn "# fping ",dump($status);