[smokeping-users] TCPPing probe doesn't generate data
G.W. Haywood
ged at jubileegroup.co.uk
Tue Jun 17 10:16:49 CEST 2008
Hi there,
On Tue, 17 Jun 2008, David Tomic wrote:
> Hmmmm ... nope. Still nothing to do with tcppingg in either
> /var/log/messages or /var/log/apache2/error.log
Oh, heck, what am I doing? I've led you up the garden path a bit.
TCPPing.pm isn't run by Apache, it's run by the smokeping daemon, and
the debug output from it most definitely doesn't go to Apache's error
log, I think on your system it goes to /var/log/messages. For further
debugging it's probably better to use the style that the authors used
rather than my "print STDERR" style, you can more-or-less copy it from
the debug lines in there already and tweak it to suit your purposes.
Are you still 2running smokeping with the --debug flag? I don't think
I've even mentioned it although youmentioned it in one of your earlier
mails and I was quite impressed that you'd foind out how to use it.
The --debug flag is needed for the debug lines in TCPPing.pm to produce
the debug output from those lines in the sripts which look like this:
$self->do_debug("Something in quotes");
In this case all you'd see in the log would be some text, so all you'd
know from that is that the line was executed. Nevertheless that can
often be useful if you're trying to trace the program flow. However
it can be much more useful to see the values of variables as the code
executes, and you can do that easily too. In Perl, you can refer to
variables within double-quoted strings like the line above, and Perl
will helpfully interpolate them into the string before it prints it.
So you can say:
$self->do_debug("Value = $scalar_value");
$self->do_debug("Array = @array");
and so on and in the debug log you will see the text followed by the
values of the variables. In the case of an array, Perl will separate
the individual element values with a separator which is held in one
another variable called the list separator (known as $"), which is set
to a space by default. There are a few of these idiosyncratically-
named 'special variables' which tend to be used a lot in Perl scripts.
In TCPPing.pm the output from tcptraceroute is stored in $_ and it's
parsed by the lines here:
8<----------------------------------------------------------------------
while (<$outh>){
chomp;
$self->do_debug("TCPPing.pm: pingone: Got output: '$_'"); # 15.06.08: -- GWH --
next unless /^\S+\s+:\s+[\d\.]/; #filter out error messages from tcpping
@times = split /\s+/;
my $ip = shift @times;
next unless ':' eq shift @times; #drop the colon
@times = map {sprintf "%.10e", $_ / $self->{pingfactor}} sort {$a <=> $b} grep /^\d/, @times;
}
8<----------------------------------------------------------------------
As you can see I've tweaked the lines a little from the original, I
like the debug output to tell me which script it's from and which
function in the script so that you can see what's going on in the log.
Here's the debug output in /var/log/messages from probes to a couple
of machines on my LAN:
8<----------------------------------------------------------------------
Jun 17 08:57:30 tornado smokeping[27472]: TCPPing: forks 5, timeout for each target 46
Jun 17 08:57:30 tornado smokeping[28713]: TCPPing: TCPPing.pm: pingone: Executing /usr/bin/tcpping -C -x 3 pk2.local.jubileegroup.co.uk 22
Jun 17 08:57:30 tornado smokeping[28712]: TCPPing: TCPPing.pm: pingone: Executing /usr/bin/tcpping -C -x 3 192.168.0.252 22
Jun 17 08:57:33 tornado smokeping[28713]: TCPPing: TCPPing.pm: pingone: Got output: 'pk2.local.jubileegroup.co.uk : 0.140 0.182 0.182'
Jun 17 08:57:33 tornado smokeping[27472]: TCPPing: pk2.local.jubileegroup.co.uk: got 1.4000000000e-04 1.8200000000e-04 1.8200000000e-04
Jun 17 08:57:33 tornado smokeping[28712]: TCPPing: TCPPing.pm: pingone: Got output: '192.168.0.252 : 5.722 8.353 5.410'
Jun 17 08:57:33 tornado smokeping[27472]: TCPPing: 192.168.0.252: got 5.4100000000e-03 5.7220000000e-03 8.3530000000e-03
8<----------------------------------------------------------------------
Are you seeing nothing like that at all?
--
73,
Ged.
More information about the smokeping-users
mailing list