Build precise queries to find exactly what you need
Press ESC to close
Join our next live webinar: “Advanced Nagios Monitoring Techniques” – Register Now
@rhousand
Favorites0
Views
Projects0
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} "; } } } }
Reviewed 11 years ago
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
Reviewed 12 years ago