Projet

Général

Profil

Révision d112f623

IDd112f623fb1b700b5708dfa529a2cbea13f6aabf
Parent 4699dea3
Enfant d573ab04

Ajouté par Artem Sheremet il y a environ 13 ans

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

Voir les différences:

plugins/network/ping/ping
171 171
				my @ping = `$h_ping $ping_args $h_addr $ping_args2`;
172 172
				chomp @ping;
173 173
				my $ping = join(" ", @ping);
174
				my $ping_time = ($1 / 1000) if ($ping =~ m@min/avg/max.*\s\d+(?:\.\d+)?/(\d+(?:\.\d+)?)/\d+(?:\.\d+)?@);
175
				my $packet_loss = $1 if ($ping =~ /(\d+)% packet loss/);
174
				my $ping_time = "U";
175
				my $packet_loss = "U";
176
				$ping_time = ($1 / 1000) if ($ping =~ m@min/avg/max.*\s\d+(?:\.\d+)?/(\d+(?:\.\d+)?)/\d+(?:\.\d+)?@);
177
				$packet_loss = $1 if ($ping =~ /(\d+)% packet loss/);
176 178
				print "$h_norm_name.value ". ($packetloss_mode ? $packet_loss : $ping_time) . "\n";
177 179
				if ($pid == 0) {
178 180
					# this is a child process, don't forget to exit

Formats disponibles : Unified diff