diff options
Diffstat (limited to 'collectors')
-rwxr-xr-x | collectors/ping.pl | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/collectors/ping.pl b/collectors/ping.pl index 7902663..b5f7bbf 100755 --- a/collectors/ping.pl +++ b/collectors/ping.pl @@ -26,7 +26,9 @@ while (1) { $q->execute; my %ip_to_switch = (); my %secondary_ip_to_switch = (); + my $affected = 0; while (my $ref = $q->fetchrow_hashref) { + $affected++; my $switch = $ref->{'switch'}; my $ip = $ref->{'ip'}; @@ -39,6 +41,12 @@ while (1) { $secondary_ip_to_switch{$secondary_ip} = $switch; } } + if ($affected == 0) { + print "Nothing to do... sleeping 1 second...\n"; + sleep(1); + next; + } + my $result = $ping->ping(); my %dropped = %{$ping->get_dropped()}; die $ping->get_error if (!defined($result)); |