diff options
author | Tobias Oetiker <tobi@oetiker.ch> | 2011-12-03 12:58:33 +0100 |
---|---|---|
committer | Tobias Oetiker <tobi@oetiker.ch> | 2011-12-03 12:58:33 +0100 |
commit | cda6cb8ef889fd0d7f08848025ea4687b41b2c1d (patch) | |
tree | 7b30f93b6133b2bc4b042e345f3efa58ad9717a2 /lib | |
parent | 0f421fbf603b2427a6c010cdd375bf40b3aacabb (diff) | |
download | smokeping-cda6cb8ef889fd0d7f08848025ea4687b41b2c1d.tar.gz smokeping-cda6cb8ef889fd0d7f08848025ea4687b41b2c1d.tar.xz |
From: Chris Wilson <chris@aptivate.org>
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)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Smokeping/probes/TCPPing.pm | 21 |
1 files changed, 17 insertions, 4 deletions
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; |