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

oerli

Reviews(2)
Changed the following to get it to work and Date check if it's unknown.

--- /home/rmu/check_apc.pl 2013-07-31 13:29:08.893074154 +0200
+++ check_apc.pl 2013-08-02 10:06:06.328270476 +0200
@@ -1,4 +1,6 @@
#!/usr/bin/perl -w
+# This Script doesn't work with the Embedded Perl from icinga, disable it:
+# icinga: -epn
#
# check_apc.pl v1.0
#
@@ -174,6 +176,10 @@
# If Okay, then check the date of the last self test before returning result of check
# First the returned date is converted to epoch for simplified date math
# UPS returns date as mm/dd/yyyy
+ if (lc($diag_date) eq "unknown"){
+ print "WARNING: Unknown when self test run last time\n";
+ exit $WARNING;
+ }else{
my @diagdate_split = split(/\//,$diag_date);
my $diagdate_epoch = timelocal(0,0,12,$diagdate_split[1],$diagdate_split[0] - 1,$diagdate_split[2]);
my $diag_daysago = int((time - $diagdate_epoch) / 86400 + 0.5); # How many days since last self test
@@ -188,6 +194,7 @@
print "OK: Self test passed on $diag_date ($diag_daysago days ago)\n";
exit $OKAY;
}
+ }
}
}
case m/^load$|^load:\d{2,5}$/{
byoerli, May 10, 2010
I needed to change the result from 2.7.1 to 2.7.0 and I added the exit 1; otherwise the state won't change in nagios. thanks for this script!

if ($result =~/2.7.0 Ok, discarded/) {
print "OK - All fine\n"
} else {
print "CRITICAL - amavisd-new returned $result";
exit 1;
}