diff options
Diffstat (limited to 'collectors/ping.pl')
-rwxr-xr-x | collectors/ping.pl | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/collectors/ping.pl b/collectors/ping.pl index c1a4af3..d5acded 100755 --- a/collectors/ping.pl +++ b/collectors/ping.pl @@ -19,10 +19,13 @@ my $q = $dbh->prepare("SELECT switch,host(mgmt_v4_addr) as ip,host(mgmt_v6_addr) my $lq = $dbh->prepare("SELECT linknet,addr1,addr2 FROM linknets WHERE addr1 is not null and addr2 is not null;"); my $last = time(); -my $target = 1.0; +my $target = 0.2; while (1) { my $now = time(); - sleep($target - ($now - $last)); + my $elapsed = ($now - $last); + if ($elapsed < $target) { + sleep($target - ($now - $last)); + } $last = time(); # ping loopbacks my $ping = Net::Oping->new; |