added pandora_block_ping to check response of multiple addresses

Former-commit-id: a2202f029e0fae80f3156a1a10afca0fe18c7ac2
This commit is contained in:
fbsanchez 2019-01-28 20:02:58 +01:00
parent 042bf1c6e7
commit d0d95cbca5
1 changed files with 19 additions and 0 deletions

View File

@ -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>) >>