Home Directory

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

Directory

rhousand

Reviews(2)
check_mssql_health
Script errored due to empty $minutessincestart:

sub nagios {
my $self = shift;
my %params = @_;
if (! $self->{nagios_level}) {
if ($params{mode} =~ /server::jobs::failed/) {
if ($self->{lastrunstatus} ne "succeeded") {
if ($self->{lastrunstatus} eq "failed") {
$self->add_nagios_critical(
sprintf "%s failed: %s", $self->{name}, $self->{lastrunstatusmessage});
} elsif ($self->{lastrunstatus} eq "retry" || $self->{lastrunstatus} eq "canceled") {
$self->add_nagios_warning(
sprintf "%s %s: %s", $self->{name}, $self->{lastrunstatus}, $self->{lastrunstatusmessage});
} else {
if ($self->{lastrunstatus}) {
print "else: $params{mode} $self->{name} $self->{lastrunstatus}
";
$self->add_nagios(
$self->check_thresholds($self->{lastrundurationseconds}, 60, 300),
#sprintf("job %s ran for %d seconds (started %s)
", $self->{name},
sprintf("job %s ran for %d seconds (started %s)", $self->{name},
$self->{lastrundurationseconds}, $self->{lastrundatetime}));
}
}
} else {
print "OK - $self->{name}, $self->{lastrundurationseconds}, $self->{lastrundatetime}
";
}
}
}
}


Script alerted if lastrunstatus was not set:

sub nagios {
my $self = shift;
my %params = @_;
if (! $self->{nagios_level}) {
if ($params{mode} =~ /server::jobs::failed/) {
if ($self->{lastrunstatus} ne "succeeded") {
if ($self->{lastrunstatus} eq "failed") {
$self->add_nagios_critical(
sprintf "%s failed: %s", $self->{name}, $self->{lastrunstatusmessage});
} elsif ($self->{lastrunstatus} eq "retry" || $self->{lastrunstatus} eq "canceled") {
$self->add_nagios_warning(
sprintf "%s %s: %s", $self->{name}, $self->{lastrunstatus}, $self->{lastrunstatusmessage});
} else {
if ($self->{lastrunstatus}) {
print "else: $params{mode} $self->{name} $self->{lastrunstatus}
";
$self->add_nagios(
$self->check_thresholds($self->{lastrundurationseconds}, 60, 300),
#sprintf("job %s ran for %d seconds (started %s)
", $self->{name},
sprintf("job %s ran for %d seconds (started %s)", $self->{name},
$self->{lastrundurationseconds}, $self->{lastrundatetime}));
}
}
} else {
print "OK - $self->{name}, $self->{lastrundurationseconds}, $self->{lastrundatetime}
";
}
}
}
}
byrhousand, July 19, 2013
Added $TABLE
CHKIPTBLS=`/sbin/iptables -n -t $TABLE -L |wc -l`

Added nrpe user to sudoers
Defaults!/usr/local/nagios/libexec/check_iptables.sh !requiretty
nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_iptables.sh


I would not recommend adding to following to sudoers.
nagios ALL= NOPASSWD: /sbin/iptables

I also imported utils.sh and used it's exit codes but this may not be required.
. /usr/local/nagios/libexec/utils.sh

exit $STATE_OK
exit $STATE_CRITICAL