mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-23 06:35:42 +00:00
Fixing a warning in the ping plugin
Error message: Use of uninitialized value $ping_time in concatenation (.) or string at /etc/munin/plugins/ping line 176. Fix is to declare a variable prior to using it in postfix-if assignment
This commit is contained in:
parent
4699dea341
commit
d112f623fb
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