Revivied codes to improve ping performance that was degraded in

Pandora FMS 4.0.
This commit is contained in:
Junichi Satoh 2015-02-22 23:29:56 +09:00
parent 308c538dd7
commit 49cdb38f90

View File

@ -872,10 +872,13 @@ sub pandora_ping ($$$$) {
# Windows XP .. Windows 7 # Windows XP .. Windows 7
if (($OSNAME eq "MSWin32") || ($OSNAME eq "MSWin32-x64") || ($OSNAME eq "cygwin")){ if (($OSNAME eq "MSWin32") || ($OSNAME eq "MSWin32-x64") || ($OSNAME eq "cygwin")){
my $ms_timeout = $timeout * 1000; my $ms_timeout = $timeout * 1000;
$output = `ping -n $retries -w $ms_timeout $host`; for ($i=0; $i < $retries; $i++) {
$output = `ping -n 1 -w $ms_timeout $host`;
if ($output =~ /TTL/){ if ($output =~ /TTL/){
return 1; return 1;
} }
sleep 1;
}
return 0; return 0;
} }
@ -890,10 +893,13 @@ sub pandora_ping ($$$$) {
# 'networktimeout' is not used by ping on Solaris. # 'networktimeout' is not used by ping on Solaris.
# Ping the host # Ping the host
`$ping_command -s -n $host 56 $retries >$DEVNULL 2>&1`; for ($i=0; $i < $retries; $i++) {
`$ping_command -s -n $host 56 1 >$DEVNULL 2>&1`;
if ($? == 0) { if ($? == 0) {
return 1; return 1;
} }
sleep 1;
}
return 0; return 0;
} }
@ -908,10 +914,13 @@ sub pandora_ping ($$$$) {
# 'networktimeout' is not used by ping6 on FreeBSD. # 'networktimeout' is not used by ping6 on FreeBSD.
# Ping the host # Ping the host
`$ping_command -q -n -c $retries $host >$DEVNULL 2>&1`; for ($i=0; $i < $retries; $i++) {
`$ping_command -q -n -c 1 $host >$DEVNULL 2>&1`;
if ($? == 0) { if ($? == 0) {
return 1; return 1;
} }
sleep 1;
}
return 0; return 0;
} }
@ -926,10 +935,13 @@ sub pandora_ping ($$$$) {
# 'networktimeout' is not used by ping6 on NetBSD. # 'networktimeout' is not used by ping6 on NetBSD.
# Ping the host # Ping the host
`$ping_command -q -n -c $retries $host >$DEVNULL 2>&1`; for ($i=0; $i < $retries; $i++) {
`$ping_command -q -n -c 1 $host >$DEVNULL 2>&1`;
if ($? == 0) { if ($? == 0) {
return 1; return 1;
} }
sleep 1;
}
return 0; return 0;
} }
@ -943,10 +955,13 @@ sub pandora_ping ($$$$) {
} }
# Ping the host # Ping the host
`$ping_command -q -W $timeout -n -c $retries $host >$DEVNULL 2>&1`; for ($i=0; $i < $retries; $i++) {
`$ping_command -q -W $timeout -n -c 1 $host >$DEVNULL 2>&1`;
if ($? == 0) { if ($? == 0) {
return 1; return 1;
} }
sleep 1;
}
return 0; return 0;
} }