Random Project

Didn’t worked with the Embedded Perl Compiler

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 timen”;
+ 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}$/{