2013-02-06 Sergio Martin <sergio.martin@artica.es>
* lib/PandoraFMS/NetworkServer.pm lib/PandoraFMS/Tools.pm: Added check to the ping latency modules to difference the fail from the 0 latency. Now when the IP doenst exist or the ping fail, the module doesnt report any data. FIX: 3543467 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7600 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
2d125b0991
commit
434d97c8f4
|
@ -1,3 +1,11 @@
|
|||
2013-02-06 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* lib/PandoraFMS/NetworkServer.pm
|
||||
lib/PandoraFMS/Tools.pm: Added check to the ping latency
|
||||
modules to difference the fail from the 0 latency. Now
|
||||
when the IP doenst exist or the ping fail, the module
|
||||
doesnt report any data. FIX: 3543467
|
||||
|
||||
2013-02-05 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* util/pandora_manage.pl: Added feature for adding
|
||||
|
|
|
@ -456,7 +456,10 @@ sub exec_network_module ($$$$) {
|
|||
}
|
||||
elsif ($id_tipo_modulo == 7){ # ICMP (data for latency in ms)
|
||||
$module_data = pandora_ping_latency ($pa_config, $ip_target, $timeout, $retries);
|
||||
$module_result = 0; # Successful
|
||||
|
||||
if (defined($module_data)) {
|
||||
$module_result = 0; # Successful
|
||||
}
|
||||
}
|
||||
|
||||
# -------------------------------------------------------
|
||||
|
|
|
@ -889,7 +889,7 @@ sub pandora_ping ($$$$) {
|
|||
########################################################################
|
||||
=head2 C<< pandora_ping_latency (I<$pa_config>, I<$host>) >>
|
||||
|
||||
Ping the given host. Returns the average round-trip time.
|
||||
Ping the given host. Returns the average round-trip time. Returns undef if fails.
|
||||
|
||||
=cut
|
||||
########################################################################
|
||||
|
@ -925,7 +925,7 @@ sub pandora_ping_latency ($$$$) {
|
|||
if ($output =~ m/\=\s([0-9]*)[a-z][a-z]\r/){
|
||||
return $1;
|
||||
} else {
|
||||
return 0;
|
||||
return undef;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -944,11 +944,11 @@ sub pandora_ping_latency ($$$$) {
|
|||
my @output = `$ping_command -s -n $host 56 $retries 2>/dev/null`;
|
||||
|
||||
# Something went wrong
|
||||
return 0 if ($? != 0);
|
||||
return undef if ($? != 0);
|
||||
|
||||
# Parse the output
|
||||
my $stats = pop (@output);
|
||||
return 0 unless ($stats =~ m/([\d\.]+)\/([\d\.]+)\/([\d\.]+)\/([\d\.]+) +ms/);
|
||||
return undef unless ($stats =~ m/([\d\.]+)\/([\d\.]+)\/([\d\.]+)\/([\d\.]+) +ms/);
|
||||
return $2;
|
||||
}
|
||||
|
||||
|
@ -968,11 +968,11 @@ sub pandora_ping_latency ($$$$) {
|
|||
my @output = `$ping_command -q -n -c $retries $host 2>/dev/null`;
|
||||
|
||||
# Something went wrong
|
||||
return 0 if ($? != 0);
|
||||
return undef if ($? != 0);
|
||||
|
||||
# Parse the output
|
||||
my $stats = pop (@output);
|
||||
return 0 unless ($stats =~ m/([\d\.]+)\/([\d\.]+)\/([\d\.]+)\/([\d\.]+) +ms/);
|
||||
return undef unless ($stats =~ m/([\d\.]+)\/([\d\.]+)\/([\d\.]+)\/([\d\.]+) +ms/);
|
||||
return $2;
|
||||
}
|
||||
|
||||
|
@ -989,11 +989,11 @@ sub pandora_ping_latency ($$$$) {
|
|||
my @output = `$ping_command -q -W $timeout -n -c $retries $host 2>/dev/null`;
|
||||
|
||||
# Something went wrong
|
||||
return 0 if ($? != 0);
|
||||
return undef if ($? != 0);
|
||||
|
||||
# Parse the output
|
||||
my $stats = pop (@output);
|
||||
return 0 unless ($stats =~ m/([\d\.]+)\/([\d\.]+)\/([\d\.]+)\/([\d\.]+) +ms/);
|
||||
return undef unless ($stats =~ m/([\d\.]+)\/([\d\.]+)\/([\d\.]+)\/([\d\.]+) +ms/);
|
||||
return $2;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue