From cda6cb8ef889fd0d7f08848025ea4687b41b2c1d Mon Sep 17 00:00:00 2001 From: Tobias Oetiker Date: Sat, 3 Dec 2011 12:58:33 +0100 Subject: From: Chris Wilson Date: Fri, 2 Dec 2011 20:38:26 +0000 (GMT) I tried to use the tcpping probe but it didn't work for me (centos 5). It seems that the tcptraceroute output format has changed or there is a problem with the script's ability to parse options. It also doesn't report tcptraceroute errors properly or have much in the way of debugging support. And it required smokeping to be run as root. I think I have fixed these issues, and posted updated versions here: https://github.com/aptivate/network-scripts/blob/master/TCPPing.pm https://github.com/aptivate/network-scripts/blob/master/tcpping I hope that you will consider these for inclusion in your projects. Richard, are you still maintaining tcpping? If not, is it worth merging this functionality into the TCPPing module? (integrated the TCPPing.pm for now -- tobi) --- CHANGES | 2 ++ lib/Smokeping/probes/TCPPing.pm | 21 +++++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index bfb5875..8130241 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +* Updated TCPPing probe -- Chris Wilson chris aptivate.org + * Make Median matcher work without complaint at startup and if unknown data elements occur in the stream. 2011/11/12 -- released version 2.6.6 diff --git a/lib/Smokeping/probes/TCPPing.pm b/lib/Smokeping/probes/TCPPing.pm index 4348775..4fc3816 100644 --- a/lib/Smokeping/probes/TCPPing.pm +++ b/lib/Smokeping/probes/TCPPing.pm @@ -89,7 +89,7 @@ sub probevars { return $class->_makevars($class->SUPER::probevars, { _mandatory => [ 'binary' ], binary => { - _doc => "The location of your TCPPing script.", + _doc => "The location of your tcpping script.", _example => '/usr/bin/tcpping', _sub => sub { my $val = shift; @@ -98,12 +98,16 @@ sub probevars { unless -f $val and -x _; my $return = `$val -C -x 1 localhost 2>&1`; - return "ERROR: TCPPing must be installed setuid root or it will not work\n" + return "ERROR: tcpping must be installed setuid root or it will not work\n" if $return =~ m/only.+root/; return undef; }, }, + tcptraceroute => { + _doc => "tcptraceroute Options to pass to tcpping.", + _example => '-e "sudo /bin/tcptraceroute"', + }, }); } @@ -140,12 +144,21 @@ sub pingone ($){ my @cmd = ( $self->{properties}{binary}, - '-C', '-x', $self->pings($target), - $target->{addr}, @port); + '-C', '-x', $self->pings($target) + ); + + if ($self->{properties}{tcptraceroute}) + { + push @cmd, '-e', $self->{properties}{tcptraceroute}; + } + + push @cmd, $target->{addr}, @port; + $self->do_debug("Executing @cmd"); my $pid = open3($inh,$outh,$errh, @cmd); while (<$outh>){ chomp; + $self->do_debug("Received: $outh"); next unless /^\S+\s+:\s+[\d\.]/; #filter out error messages from tcpping @times = split /\s+/; my $ip = shift @times; -- cgit v1.2.3-24-g4f1b