1
package probes::EchoPingHttp;
5
probes::EchoPingHttp - an echoping(1) probe for SmokePing
9
Measures HTTP roundtrip times (web servers and caches) for SmokePing.
16
binary = /usr/bin/echoping # mandatory
27
port = 80 # default value anyway
28
timeout = 50 # default is 10s
32
Supported probe-specific variables: those specified in EchoPing(3pm)
35
Supported target-specific variables:
39
=item those specified in EchoPing(3pm) documentation
41
except I<fill>, I<size> and I<udp>.
45
The URL to be requested from the web server or cache. Can be either relative
46
(/...) for web servers or absolute (http://...) for caches.
50
The TCP port to use. The default is 80.
54
The echoping(1) "-A" option: force the proxy to ignore the cache.
55
Enabled if the value is anything other than 'no' or '0'.
59
The echoping(1) "-a" option: force the proxy to revalidate data with original
60
server. Enabled if the value is anything other than 'no' or '0'.
64
The echoping(1) "-t" option: Number of seconds to wait a reply before giving up. For TCP,
65
this is the maximum number of seconds for the whole connection
66
(setup and data exchange).
72
Niko Tyni E<lt>ntyni@iki.fiE<gt>
76
EchoPing(3pm), EchoPingHttps(3pm)
81
use base qw(probes::EchoPing);
86
# HTTP doesn't fit with filling or size
87
my $arghashref = $self->features;
88
delete $arghashref->{size};
89
delete $arghashref->{fill};
92
# tag the port number after the hostname
97
my $host = $self->SUPER::make_host($target);
98
my $port = $target->{vars}{port};
99
$port = $self->{properties}{port} unless defined $port;
101
$host .= ":$port" if defined $port;
108
my $url = $target->{vars}{url};
109
$url = $self->{properties}{url} unless defined $url;
110
$url = "/" unless defined $url;
112
my @args = ("-h", $url);
115
my $timeout = $target->{vars}{timeout};
116
$timeout = $self->{properties}{timeout}
117
unless defined $timeout;
118
push @args, "-t $timeout" if $timeout;
121
my $ignore = $target->{vars}{ignore_cache};
122
$ignore = $self->{properties}{ignore_cache}
123
unless defined $ignore;
125
if (defined $ignore and $ignore ne "no"
127
push @args, "-A" if $ignore and not exists $self->{_disabled}{A};
129
# -a : force cache to revalidate the data
130
my $revalidate = $target->{vars}{revalidate_data};
131
$revalidate = $self->{properties}{revalidate_data}
132
unless defined $revalidate;
133
$revalidate= 1 if (defined $revalidate and $revalidate ne "no"
134
and $revalidate ne "0");
135
push @args, "-a" if $revalidate and not exists $self->{_disabled}{a};
142
my $bin = $self->{properties}{binary};
143
croak("Your echoping binary doesn't support HTTP")
144
if `$bin -h/ 127.0.0.1 2>&1` =~ /(invalid option|not compiled|usage)/i;
145
if (`$bin -a -h/ 127.0.0.1 2>&1` =~ /(invalid option|not compiled|usage)/i) {
146
carp("Note: your echoping binary doesn't support revalidating (-a), disabling it");
147
$self->{_disabled}{a} = undef;
150
if (`$bin -A -h/ 127.0.0.1 2>&1` =~ /(invalid option|not compiled|usage)/i) {
151
carp("Note: your echoping binary doesn't support ignoring cache (-A), disabling it");
152
$self->{_disabled}{A} = undef;
155
$self->SUPER::test_usage;
160
return "HTTP pings using echoping(1)";