diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index 5c9f974efb..1146e8ce92 100755 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -112,6 +112,7 @@ our @EXPORT = qw( md5_init pandora_ping pandora_ping_latency + pandora_block_ping resolve_hostname ticks_totime safe_input @@ -1273,6 +1274,24 @@ sub pandora_ping_latency ($$$$) { return $output; } +######################################################################## +=head2 C<< pandora_block_ping (I<$pa_config>, I<$hosts>) >> + +Ping all given hosts. Returns an array with all hosts detected as alive. + +=cut +######################################################################## +sub pandora_block_ping($@) { + my ($pa_config, @hosts) = @_; + + # fping timeout in milliseconds + my $cmd = $pa_config->{'fping'} . " -a -q -t " . (1000 * $pa_config->{'networktimeout'}) . " " . (join (' ', @hosts)); + + my @output = `$cmd 2>$DEVNULL`; + + return @output; +} + ######################################################################## =head2 C<< month_have_days (I<$month>, I<$year>) >>