package Smokeping::probes::EchoPingHttp; =head1 301 Moved Permanently This is a Smokeping probe module. Please use the command C to view the documentation or the command C to generate the POD document. =cut use strict; use base qw(Smokeping::probes::EchoPing); use Carp; sub pod_hash { return { name => < < < variable than the default 20, as repetitive URL fetching may be quite heavy on the server. The I, I and I EchoPing variables are not valid for EchoPingHttp. DOC authors => <<'DOC', Niko Tyni DOC see_also => <, L DOC } } sub _init { my $self = shift; # HTTP doesn't fit with filling or size my $arghashref = $self->features; delete $arghashref->{size}; delete $arghashref->{fill}; } # tag the port number after the hostname sub make_host { my $self = shift; my $target = shift; my $host = $self->SUPER::make_host($target); my $port = $target->{vars}{port}; $host .= ":$port" if defined $port; return $host; } sub proto_args { my $self = shift; my $target = shift; my $url = $target->{vars}{url}; my @args = ("-h", $url); # -A : ignore cache my $ignore = $target->{vars}{ignore_cache}; $ignore = 1 if (defined $ignore and $ignore ne "no" and $ignore ne "0"); push @args, "-A" if $ignore; # -a : force cache to revalidate the data my $revalidate = $target->{vars}{revalidate_data}; $revalidate= 1 if (defined $revalidate and $revalidate ne "no" and $revalidate ne "0"); push @args, "-a" if $revalidate; # -R : accept HTTP redirects my $accept_redirects = $target->{vars}{accept_redirects}; $accept_redirects= 1 if (defined $accept_redirects and $accept_redirects ne "no" and $accept_redirects ne "0"); push @args, "-R" if $accept_redirects; return @args; } sub ProbeDesc($) { return "HTTP pings using echoping(1)"; } sub targetvars { my $class = shift; my $h = $class->SUPER::targetvars; delete $h->{udp}; delete $h->{fill}; delete $h->{size}; $h->{timeout}{default} = 10; $h->{timeout}{example} = 20; return $class->_makevars($h, { url => { _doc => < '/', }, port => { _doc => 'The TCP port to use.', _example => 80, _re => '\d+', }, ignore_cache => { _doc => < 'yes', }, revalidate_data => { _doc => < 'no', }, accept_redirects => { _doc => < 'yes', }, }); } 1;