diff options
author | Tobias Oetiker <tobi@oetiker.ch> | 2012-08-29 09:49:57 +0200 |
---|---|---|
committer | Tobias Oetiker <tobi@oetiker.ch> | 2012-08-29 09:49:57 +0200 |
commit | 491498b57a427230069604d10b68073c0f6f5e33 (patch) | |
tree | 6943298a8a3ee05ba5216ff882bc0353f05e3fbc /lib/Smokeping | |
parent | 7e4c58744dc9f8b8656f88612fd58f54b7e522e4 (diff) | |
download | smokeping-491498b57a427230069604d10b68073c0f6f5e33.tar.gz smokeping-491498b57a427230069604d10b68073c0f6f5e33.tar.xz |
allow to configure FPing probe to read fping output form stdout instead of stderr
Diffstat (limited to 'lib/Smokeping')
-rw-r--r-- | lib/Smokeping/probes/FPing.pm | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Smokeping/probes/FPing.pm b/lib/Smokeping/probes/FPing.pm index 2b932bf..0901201 100644 --- a/lib/Smokeping/probes/FPing.pm +++ b/lib/Smokeping/probes/FPing.pm @@ -32,6 +32,9 @@ your system yet, you can get a slightly enhanced version from L<www.smokeping.or The (optional) B<packetsize> option lets you configure the packetsize for the pings sent. +Since version 3.3 fping sends its statistics to stdout. Set B<usestdout> to 'true' +so make smokeping read stdout instead of stderr. + In B<blazemode>, FPing sends one more ping than requested, and discards the first RTT value returned as it's likely to be an outlier. @@ -142,7 +145,8 @@ sub ping ($){ $self->do_debug("Executing @cmd"); my $pid = open3($inh,$outh,$errh, @cmd); $self->{rtts}={}; - while (<$errh>){ + my $fh = $self->{properties}{usestdout} || '') eq 'true' ? $outh : $errh; + while (<$fh>){ chomp; $self->do_debug("Got fping output: '$_'"); next unless /^\S+\s+:\s+[-\d\.]/; #filter out error messages from fping @@ -194,6 +198,12 @@ sub probevars { _doc => "Send an extra ping and then discarge the first answer since the first is bound to be an outliner.", }, + usestdout => { + _re => '(true|false)', + _example => 'true', + _doc => "Listen for FPing output on stdout instead of stderr ... (version 3.3+ sends its statistics on stdout).", + + }, timeout => { _re => '(\d*\.)?\d+', _example => 1.5, |