App-madeye

 view release on metacpan or  search on metacpan

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

            $password,
            {RaiseError => 1, AutoCommit => 1}
        );
    };

    if ($@) {
        return $@;
    } elsif (! $dbh->ping) {
        return "DEAD";
    } else {
        return; # alive.
    }
}

1;
__END__

=head1 NAME

App::MadEye::Plugin::Agent::DBI - monitoring DB

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


    my $dns = Net::DNS::Resolver->new(
        recurse     => 0,
        nameservers => ref($host) eq 'ARRAY' ? $host :  [$host],
    );
    $dns->tcp_timeout($timeout);
    $dns->udp_timeout($timeout);
    my $packet = $dns->search($name);
    if ($packet) {
        if ($packet->string =~ /$ip/) {
            return; # alive.
        } else {
            return "invalid IP : " . $packet->string;
        }
    } else {
        return 'DEAD';
    }
}

1;

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


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

    my ($can_read,) = $select->can_read($select_timeout);
    if ($can_read) {
        my $line = <$sock>;
        $sock->close;

        if ($line =~ /$message/) {
            return; # This server is still alive!
        } else {
            return "this ftp server is dead!! : $line";
        }
    } else {
        $sock->close;
        return "pure-ftpd connection timeout : $host";
    }
}

1;

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

    }

    my $err;
    my $res = Gearman::Util::read_res_packet( $sock, \$err );
    if ( $res && $res->{type} eq "error" ) {
        die "Error packet from server after get_status: ${$res->{blobref}}\n";
    }

    if ( $res && $res->{type} eq 'echo_res' && ${ $res->{blobref} } eq $MSG ) {
        $sock->close();
        return; # alive
    }
    else {
        $sock->close();
        return "gearmand response is invaild : $res->{type}";
    }
}

1;
__END__

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

        last unless $error;
    }

    if ($error) {
        return "ERROR: $@";
    }
    elsif (scalar(@hosts) == 0) {
        return "THIS TRACKER HAS NO STORE";
    }
    else {
        return; # alive!
    }
}

1;
__END__

=for stopwords mogilefsd

=head1 NAME

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

        if ( $row->{'Slave_SQL_Running'} ne 'Yes' ) {
            return "Slave SQL Not Running\n";
        }

        my $rmlp = $row->{'Read_Master_Log_Pos'};
        my $emlp = $row->{'Exec_Master_Log_Pos'};
        if ( abs($rmlp - $emlp) > $threshold ) {
            return "considerable delay : $rmlp $emlp\n";
        }

        return; # alive!
    } else {
        return "this is not a slave!";
    }
}

1;
__END__

=head1 NAME

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


    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__

=for stopwords Perlbal

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

            Hello   => $host,
            Port    => $port,
            NoTLS   => 1,
            Timeout => $timeout,
        );
    };
    if ($@) {
        return "dead: $@";
    }
    else {
        return;    # alive!
    }
}

1;
__END__

=for stopwords smtptls

=head1 NAME

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

            ) or die "cannot get a $_ : " . $session->error
        },
    );

    my $expected = join ' ', sort { $a cmp $b } @{ $target->{ip} };
    my $got      = join ' ', sort { $a cmp $b } values %$response;

    context->log('debug' => "got: $got, expected: $expected");

    if ($got eq $expected) {
        return; # alive
    } else {
        return "got: '$got' expected: '$expected'";
    }
}

1;
__END__

=head1 NAME

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

        $host => sub {
            my $session = shift;
            my $response = $session->get_table(
                -baseoid => $hrSWRunPath,
            ) or die "cannot get a $_ : " . $session->error;
            return $response;
        }
    );

    if (first { $_ eq $process } values %$response) {
        return; # alive
    } else {
        return "404 $process not found";
    }
}

1;
__END__

=head1 NAME

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

        );
    };

    if ($@) {
        return $@;
    } else {
        my ($cnt) = $dbh->selectrow_array(q{select count(*) from error});
        if ($cnt > 0) {
            return "error count: $cnt";
        } else {
            return; # alive
        }
    }
}

1;
__END__

=head1 NAME

App::MadEye::Plugin::Agent::TheSchwartz::Error - monitoring error count of TheSchwartz

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

        );
    };

    if ($@) {
        return $@;
    } else {
        my ($cnt) = $dbh->selectrow_array(q{select count(*) from job});
        if ($cnt > $threshold) {
            return "job count: $cnt";
        } else {
            return; # alive
        }
    }
}

1;
__END__

=head1 NAME

App::MadEye::Plugin::Agent::TheSchwartz::Job - monitoring error count of TheSchwartz

lib/App/MadEye/Plugin/Check/Network.pm  view on Meta::CPAN

    }

    die "failed to connect : @{ $conf->{urls} }";
}

1;
__END__

=head1 NAME

App::MadEye::Plugin::Check::User - network is alive?

=head1 SYNOPSIS

    - module: Check::Network
      config:
        urls:
          - http://livedoor.com/
          - http://gmail.com/

=head1 AUTHOR



( run in 0.774 second using v1.01-cache-2.11-cpan-df04353d9ac )