diff --git a/pandora_server/FreeBSD/pandora_server.conf.new b/pandora_server/FreeBSD/pandora_server.conf.new index 99e726fe15..9baf57f228 100644 --- a/pandora_server/FreeBSD/pandora_server.conf.new +++ b/pandora_server/FreeBSD/pandora_server.conf.new @@ -159,7 +159,11 @@ network_threads 4 # icmp_checks x : defines number of pings for each icmp_proc module type. at least one of # that ping should be 1 to report 1. Setting this to 1 will make all icmp montioring faster but # with more probability of failure. - icmp_checks 3 + +icmp_checks 3 + +# Number of ICMP packets to send per request. +icmp_packets 1 # tcp specific options : # tcp_checks: number of tcp retries if first attempt fails. diff --git a/pandora_server/NetBSD/pandora_server.conf.new b/pandora_server/NetBSD/pandora_server.conf.new index 7567503fa1..076231e3b1 100644 --- a/pandora_server/NetBSD/pandora_server.conf.new +++ b/pandora_server/NetBSD/pandora_server.conf.new @@ -162,6 +162,9 @@ network_threads 4 icmp_checks 3 +# Number of ICMP packets to send per request. +icmp_packets 1 + # tcp specific options : # tcp_checks: number of tcp retries if first attempt fails. # tcp_timeout: specific timeout for tcp connections diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 734a655ee3..65098d97e2 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -158,6 +158,9 @@ network_threads 4 icmp_checks 3 +# Number of ICMP packets to send per request. +icmp_packets 1 + # tcp specific options : # tcp_checks: number of tcp retries if first attempt fails. # tcp_timeout: specific timeout for tcp connections diff --git a/pandora_server/conf/pandora_server.conf.windows b/pandora_server/conf/pandora_server.conf.windows index d2a54386b4..f8294396cf 100644 --- a/pandora_server/conf/pandora_server.conf.windows +++ b/pandora_server/conf/pandora_server.conf.windows @@ -131,7 +131,10 @@ network_threads 5 # that ping should be 1 to report 1. Lower value have better performance, but more probability # of false positives -icmp_checks 3. +icmp_checks 3 + +# Number of ICMP packets to send per request. +icmp_packets 1 # tcp specific options : # tcp_checks: number of tcp retries if first attempt fails. diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 7f7f80940e..3befc638db 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -208,6 +208,7 @@ sub pandora_load_config { $pa_config->{"keepalive"} = 60; # 60 Seconds initially for server keepalive $pa_config->{"keepalive_orig"} = $pa_config->{"keepalive"}; $pa_config->{"icmp_checks"} = 1; # Introduced on 1.3.1 + $pa_config->{"icmp_packets"} = 1; # > 5.1SP2 $pa_config->{"alert_recovery"} = 0; # Introduced on 1.3.1 $pa_config->{"snmp_checks"} = 1; # Introduced on 1.3.1 $pa_config->{"snmp_timeout"} = 8; # Introduced on 1.3.1 @@ -565,6 +566,9 @@ sub pandora_load_config { elsif ($parametro =~ m/^icmp_checks\s([0-9]*)/i) { $pa_config->{"icmp_checks"} = clean_blank($1); } + elsif ($parametro =~ m/^icmp_packets\s([0-9]*)/i) { + $pa_config->{"icmp_packets"} = clean_blank($1); + } elsif ($parametro =~ m/^snmpconsole\s([0-9]*)/i) { $pa_config->{"snmpconsole"} = clean_blank($1); } diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index 8534af25c6..d01bbcfbd5 100644 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -852,6 +852,7 @@ sub pandora_ping ($$$$) { if ($retries == 0) { $retries = $pa_config->{'icmp_checks'}; } + my $packets = defined($pa_config->{'icmp_packets'}) ? $pa_config->{'icmp_packets'} : 1; my $output = 0; my $i; @@ -862,9 +863,12 @@ sub pandora_ping ($$$$) { # Windows XP .. Windows 7 if (($OSNAME eq "MSWin32") || ($OSNAME eq "MSWin32-x64") || ($OSNAME eq "cygwin")){ my $ms_timeout = $timeout * 1000; - $output = `ping -n $retries -w $ms_timeout $host`; - if ($output =~ /TTL/){ - return 1; + for ($i=0; $i < $retries; $i++) { + $output = `ping -n $packets -w $ms_timeout $host`; + if ($output =~ /TTL/){ + return 1; + } + sleep 1; } return 0; } @@ -880,9 +884,12 @@ sub pandora_ping ($$$$) { # 'networktimeout' is not used by ping on Solaris. # Ping the host - `$ping_command -s -n $host 56 $retries >$DEVNULL 2>&1`; - if ($? == 0) { - return 1; + for ($i=0; $i < $retries; $i++) { + `$ping_command -s -n $host 56 $packets >$DEVNULL 2>&1`; + if ($? == 0) { + return 1; + } + sleep 1; } return 0; } @@ -898,9 +905,12 @@ sub pandora_ping ($$$$) { # 'networktimeout' is not used by ping6 on FreeBSD. # Ping the host - `$ping_command -q -n -c $retries $host >$DEVNULL 2>&1`; - if ($? == 0) { - return 1; + for ($i=0; $i < $retries; $i++) { + `$ping_command -q -n -c $packets $host >$DEVNULL 2>&1`; + if ($? == 0) { + return 1; + } + sleep 1; } return 0; } @@ -916,9 +926,12 @@ sub pandora_ping ($$$$) { # 'networktimeout' is not used by ping6 on NetBSD. # Ping the host - `$ping_command -q -n -c $retries $host >$DEVNULL 2>&1`; - if ($? == 0) { - return 1; + for ($i=0; $i < $retries; $i++) { + `$ping_command -q -n -c $packets $host >$DEVNULL 2>&1`; + if ($? == 0) { + return 1; + } + sleep 1; } return 0; } @@ -933,9 +946,12 @@ sub pandora_ping ($$$$) { } # Ping the host - `$ping_command -q -W $timeout -n -c $retries $host >$DEVNULL 2>&1`; - if ($? == 0) { - return 1; + for ($i=0; $i < $retries; $i++) { + `$ping_command -q -W $timeout -n -c $packets $host >$DEVNULL 2>&1`; + if ($? == 0) { + return 1; + } + sleep 1; } return 0; }