mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 22:25:23 +00:00
Merge pull request #198 from dotdoom/master-ping_unintialized_value_fix
Fixing a warning in the ping plugin
This commit is contained in:
commit
d573ab04db
1 changed files with 4 additions and 2 deletions
|
@ -171,8 +171,10 @@ for (my $host_i = 0; $host_i < @host_addrs; ++$host_i) {
|
||||||
my @ping = `$h_ping $ping_args $h_addr $ping_args2`;
|
my @ping = `$h_ping $ping_args $h_addr $ping_args2`;
|
||||||
chomp @ping;
|
chomp @ping;
|
||||||
my $ping = join(" ", @ping);
|
my $ping = join(" ", @ping);
|
||||||
my $ping_time = ($1 / 1000) if ($ping =~ m@min/avg/max.*\s\d+(?:\.\d+)?/(\d+(?:\.\d+)?)/\d+(?:\.\d+)?@);
|
my $ping_time = "U";
|
||||||
my $packet_loss = $1 if ($ping =~ /(\d+)% packet loss/);
|
my $packet_loss = "U";
|
||||||
|
$ping_time = ($1 / 1000) if ($ping =~ m@min/avg/max.*\s\d+(?:\.\d+)?/(\d+(?:\.\d+)?)/\d+(?:\.\d+)?@);
|
||||||
|
$packet_loss = $1 if ($ping =~ /(\d+)% packet loss/);
|
||||||
print "$h_norm_name.value ". ($packetloss_mode ? $packet_loss : $ping_time) . "\n";
|
print "$h_norm_name.value ". ($packetloss_mode ? $packet_loss : $ping_time) . "\n";
|
||||||
if ($pid == 0) {
|
if ($pid == 0) {
|
||||||
# this is a child process, don't forget to exit
|
# this is a child process, don't forget to exit
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue