[smokeping-users] Re: HTTP Status Codes with Smokeping & Curl ??
Philip Hunt (Enigma Publishing)
huntp at enigma.co.nz
Thu Feb 5 01:20:08 MET 2004
Figured out how I could do this. I changed a couple of subs in the
"while" loop in Curl.pm
A bit of a hack - but it seems to work OK.
sub proto_args {
.... <snip> ....
my @args = ("-o /dev/null", "-w 'Time: %{time_total} DNS time:
%{time_namelookup} HTTP Code: %{http_code}\\n'");
.... <snip> ....
}
sub pingone {
.... <snip> ....
# what should we do with error messages?
while (<P>) {
/^Time: (\d+\.\d+) DNS time: (\d+\.\d+) HTTP
Code: (\d+)/ ;
my $my_http_code = $3;
if ( $my_http_code ) {
if ( $my_http_code eq '200' ||
$my_http_code eq '302' ) {
push @times, $1 - $2;
} else {
$self->do_log("Test: $3");
my @times;
}
}
}
close P;
}
.... <snip> ....
}
-----Original Message-----
From: smokeping-users-bounce at list.ee.ethz.ch
[mailto:smokeping-users-bounce at list.ee.ethz.ch] On Behalf Of Philip Hunt
(Enigma Publishing)
Sent: 5 February 2004 10:37 a.m.
To: smokeping-users at list.ee.ethz.ch
Subject: [smokeping-users] HTTP Status Codes with Smokeping & Curl ??
Hi Folks,
I have smokeping running nicely.
But, is it possible to check whether an HTTP Status Code of say . "200"
(OK) is returned before using "time taken" in the database / graph?
Because, if I am checking a URL that returns say . "500" (Internal
Server Error) . I would like for the "time taken" value to be = 0 ;
i.e. the target was unavailable.
Anyone know if this is possible ?
Cheers,
Philip Hunt
Enigma Publishing Limited
Unit 2F, 100 Bush Road
PO Box 302-432 NHPC
Albany, Auckland
New Zealand
Tel: +64 9 912 9100
Fax: +64 9 486 0383
Email: huntp at enigma.co.nz
Website: www.enigma.co.nz <http://www.enigma.co.nz/>
--
Unsubscribe
mailto:smokeping-users-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:smokeping-users-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/smokeping-users
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
--
Unsubscribe mailto:smokeping-users-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:smokeping-users-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/smokeping-users
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the smokeping-users
mailing list