From 491498b57a427230069604d10b68073c0f6f5e33 Mon Sep 17 00:00:00 2001 From: Tobias Oetiker Date: Wed, 29 Aug 2012 09:49:57 +0200 Subject: allow to configure FPing probe to read fping output form stdout instead of stderr --- lib/Smokeping/probes/FPing.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 option lets you configure the packetsize for the pings sent. +Since version 3.3 fping sends its statistics to stdout. Set B to 'true' +so make smokeping read stdout instead of stderr. + In B, 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 @@ -193,6 +197,12 @@ sub probevars { _example => 'true', _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+', -- cgit v1.2.3-24-g4f1b