| App-MadEye documentation | Contained in the App-MadEye distribution. |
App::MadEye::Plugin::Agent::Perlbal - check Perlbal.
type: map
mapping:
target:
type: seq
required: yes
sequence:
- type: str
port:
required: no
type: int
timeout:
required: yes
type: int
user_agent:
required: no
type: str
Tokuhiro Matsuno
| App-MadEye documentation | Contained in the App-MadEye distribution. |
package App::MadEye::Plugin::Agent::Perlbal; use strict; use warnings; use IO::Socket::INET; use App::MadEye::Plugin::Agent::Base; my $req = <<'...'; GET / HTTP/1.0 Host: invalidhostname.example.com ... sub is_dead { my ($self, $host) = @_; my $conf = $self->config->{config}; my $port = $conf->{port} || 80; my $timeout = $conf->{timeout} || 10; my $sock = IO::Socket::INET->new( PeerAddr => $host, PeerPort => $port, Timeout => $timeout, ) or return "cannot open socket"; $sock->write($req); my $content = join '', <$sock>; if ($content =~ m{Server: Perlbal.+<h1>404 - Not Found</h1>}s) { return; # alive. } else { return "this is not a perlbal?\n\n$content"; } } 1; __END__