Skip to content
Snippets Groups Projects
Commit a58fad4b authored by Mark Harrison's avatar Mark Harrison
Browse files

Adding a DNS health check for onager

git-svn-id: https://labs.omniti.com/resmon/trunk@85 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55
parent 4c788be3
No related branches found
No related tags found
No related merge requests found
package Resmon::Module::DNS;
use Resmon::Module;
use Resmon::ExtComm qw/cache_command/;
use vars qw/@ISA/;
@ISA = qw/Resmon::Module/;
# Checks the dns server status on onager
sub handler {
my $self = shift;
my $os = $self->fresh_status();
return $os if $os;
my $object = $self->{object};
my $key = "-k $self->{key}" if $self->{key};
my $output = cache_command("rndc $key status 2>&1", 600);
if ($output) {
foreach (split(/\n/, $output)) {
if (/server is up and running/) {
return "OK", "$_";
} elsif (/^rndc: neither \S+ nor (\S+) was found$/) {
return "BAD", "Key file $1 not found";
} elsif (/connection refused/) {
return "BAD", "$_";
}
}
}
return "BAD", "no data";
}
1;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment