summaryrefslogtreecommitdiffstats
path: root/lib/Smokeping/probes/EchoPing.pm
diff options
context:
space:
mode:
authorNiko Tyni <ntyni@iki.fi>2007-10-27 15:00:42 +0200
committerNiko Tyni <ntyni@iki.fi>2007-10-27 15:00:42 +0200
commitb2974cc84cbbefb8d117765acb7230530963aa5c (patch)
tree684981e37a36174d707e48bcf268317a7157f513 /lib/Smokeping/probes/EchoPing.pm
parent51243891b9e493882c59e582c5188f48e1127bed (diff)
downloadsmokeping-b2974cc84cbbefb8d117765acb7230530963aa5c.tar.gz
smokeping-b2974cc84cbbefb8d117765acb7230530963aa5c.tar.xz
* removed all the 'live' tests from the echoping probes --niko
* log a warning message on the first 'round' of pinging if curl or echoping exits with non-zero status --niko
Diffstat (limited to 'lib/Smokeping/probes/EchoPing.pm')
-rw-r--r--lib/Smokeping/probes/EchoPing.pm43
1 files changed, 15 insertions, 28 deletions
diff --git a/lib/Smokeping/probes/EchoPing.pm b/lib/Smokeping/probes/EchoPing.pm
index 95d1a6e..be3b681 100644
--- a/lib/Smokeping/probes/EchoPing.pm
+++ b/lib/Smokeping/probes/EchoPing.pm
@@ -74,33 +74,9 @@ sub new {
$self->_init if $self->can('_init');
- # no need for this if running as a CGI
- $self->test_usage unless $ENV{SERVER_SOFTWARE};
-
return $self;
}
-# warn about unsupported features
-sub test_usage {
- my $self = shift;
- my $bin = $self->{properties}{binary};
- my @unsupported;
-
- my $arghashref = $self->features;
- my %arghash = %$arghashref;
- for my $feature (keys %arghash) {
- # when the option is invalid, then echoping would
- # complain. if it is valid, then it will just display
- # the usage message.
- if (`$bin $arghash{$feature} 2>&1` !~ /^Usage/i) {
- push @unsupported, $feature;
- $self->do_log("Note: your echoping doesn't support the $feature feature (option $arghash{$feature}), disabling it");
- }
- }
- map { delete $arghashref->{$_} } @unsupported;
- return;
-}
-
sub ProbeDesc($) {
return "TCP or UDP Echo pings using echoping(1)";
}
@@ -205,14 +181,25 @@ sub pingone {
open(P, "$cmd 2>&1 |") or carp("fork: $!");
- # what should we do with error messages?
- my $echoret;
+ my @output;
while (<P>) {
- $echoret .= $_;
+ chomp;
+ push @output, $_;
/^Elapsed time: (\d+\.\d+) seconds/ and push @times, $1;
}
close P;
- $self->do_log("WARNING: $cmd was not happy: $echoret") if $?;
+ if ($?) {
+ my $status = $? >> 8;
+ my $signal = $? & 127;
+ my $why = "with status $status";
+ $why .= " [signal $signal]" if $signal;
+
+ # only log warnings on the first ping round
+ my $function = ($self->rounds_count == 1 ? "do_log" : "do_debug");
+
+ $self->$function(qq(WARNING: "$cmd" exited $why - output follows));
+ $self->$function(qq( $_)) for @output;
+ }
# carp("Got @times") if $self->debug;
return sort { $a <=> $b } @times;
}