App-madeye

 view release on metacpan or  search on metacpan

lib/App/MadEye/Plugin/Agent/DJabberd.pm  view on Meta::CPAN

    my ($self, $host) = @_;

    my $conf = $self->config->{config};
    my $admin_port = $conf->{admin_port} or die "missing admin port";
    my $open_socket_timeout = $conf->{open_socket_timeout} || 10;
    my $select_timeout      = $conf->{select_timeout}      || 3;

    my $sock = IO::Socket::INET->new(
        PeerAddr => $host,
        PeerPort => $admin_port,
        Timeout  => $open_socket_timeout,
    );
    unless ($sock) {
        return "Cannot open Socket to $host:$admin_port : $!";
    }
    $sock->blocking(0);
    $sock->setsockopt( IPPROTO_TCP, TCP_NODELAY, pack( "l", 1 ) ) or die;
    $sock->autoflush(1);

    $sock->print("version\r\n");

lib/App/MadEye/Plugin/Agent/FTP.pm  view on Meta::CPAN


    my $conf = $self->config->{config};
    my $message         = $conf->{message} or die "missing message";
    my $port            = $conf->{port}            || 21;
    my $connect_timeout = $conf->{connect_timeout} || 10;
    my $select_timeout  = $conf->{select_timeout}  || 10;

    my $sock = IO::Socket::INET->new(
        PeerAddr => $host,
        PeerPort => $port,
        Timeout  => $connect_timeout,
    );
    unless ($sock) {
        return "Cannot connect Socket to $host:$port : $!";
    }
    $sock->blocking(0);
    setsockopt($sock, IPPROTO_TCP, TCP_NODELAY, pack("l", 1)) or die;
    $sock->autoflush(1);

    my $select = IO::Select->new;
    $select->add($sock);

lib/App/MadEye/Plugin/Agent/Gearmand.pm  view on Meta::CPAN

    my ( $self, $host ) = @_;

    my $conf            = $self->config->{config};
    my $port            = $conf->{port}            || 7003;
    my $connect_timeout = $conf->{connect_timeout} || 10;
    my $select_timeout  = $conf->{select_timeout}  || 10;

    my $sock = IO::Socket::INET->new(
        PeerAddr => $host,
        PeerPort => $port,
        Timeout  => $connect_timeout,
    );
    unless ($sock) {
        return "Cannot open Socket to $host:$port\n$!";
    }
    $sock->blocking(0);
    setsockopt( $sock, IPPROTO_TCP, TCP_NODELAY, pack( "l", 1 ) ) or die;
    $sock->autoflush(1);

    my $req = Gearman::Util::pack_req_command( 'echo_req', $MSG );
    Gearman::Util::send_req( $sock, \$req );

lib/App/MadEye/Plugin/Agent/POP3S.pm  view on Meta::CPAN

    my $conf = $self->config->{config};
    my $port    = $conf->{port}    or die "missing port";
    my $timeout = $conf->{timeout} || 10;

    eval {
        my $sock = IO::Socket::SSL->new(
            PeerAddr  => $host,
            PeerPort  => $port,
            Proto     => 'tcp',
            Type      => SOCK_STREAM,
            Timeout   => $timeout,
        ) or die "can't connect pop3s $host:$port $!\n";
    };

    if ( $@ ) {
        return "pop3d is dead $@";
    } else {
        return 0;
    }
}

lib/App/MadEye/Plugin/Agent/Perlbal.pm  view on Meta::CPAN

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";
    }
}

lib/App/MadEye/Plugin/Agent/SMTP.pm  view on Meta::CPAN

use App::MadEye::Plugin::Agent::Base;

use Net::SMTP;

sub is_dead {
    my ($self, $host) = @_;

    my $conf = $self->config->{config};
    my $timeout = $conf->{timeout} || 5;

    my $smtp = Net::SMTP->new($host, Timeout => $timeout);
    if ($smtp) {
        $smtp->quit;
        return;
    } else {
        return "DEAD";
    }
}

1;
__END__

lib/App/MadEye/Plugin/Agent/SMTPTLS.pm  view on Meta::CPAN

    my $conf    = $self->config->{config};
    my $port    = $conf->{port} || 25;
    my $timeout = $conf->{timeout} || 3;

    eval {
        my $smtptls = Net::SMTP::TLS->new(
            $host,
            Hello   => $host,
            Port    => $port,
            NoTLS   => 1,
            Timeout => $timeout,
        );
    };
    if ($@) {
        return "dead: $@";
    }
    else {
        return;    # alive!
    }
}

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.798 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )