summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2010-02-20 16:00:23 +0000
committerPetter Reinholdtsen <pere@hungry.com>2010-02-20 16:00:23 +0000
commit979622e89f4c48e81a3846c85f25374b91218dd2 (patch)
tree37a1d367ebf2a428c196d1b8255c5a1fdff2e4c2
parent73f8faf71120becce89dcb9af965876066d5c858 (diff)
Make it easier to adjust how many days warning is given, and report it
in the OK message.
-rwxr-xr-xfrikanalen/bin/check_frikanalen_future10
1 files changed, 6 insertions, 4 deletions
diff --git a/frikanalen/bin/check_frikanalen_future b/frikanalen/bin/check_frikanalen_future
index f04e386..021c9c0 100755
--- a/frikanalen/bin/check_frikanalen_future
+++ b/frikanalen/bin/check_frikanalen_future
@@ -16,6 +16,8 @@ use LWP::UserAgent;
use Date::Parse;
use POSIX;
+my $numdays = 2;
+
# SOAP:Lite må modifiseres til å gjøre ting på MS måten :-/
use SOAP::Lite on_action => sub {sprintf '%s/%s', @_}, ;
@@ -35,8 +37,8 @@ for my $url (@{$listref}) {
my $stop = $event->{'stop'};
my $stoptime = str2time($stop);
- # Ignore if more than two days ahead, or stopped in the past
- next if $starttime > $now + 2 * 24 * 60 * 60;
+ # Ignore if more than $numdays days ahead, or stopped in the past
+ next if $starttime > $now + $numdays * 24 * 60 * 60;
next if $stoptime < $now;
# Why do this test fail to keep entries with no start entry
@@ -54,7 +56,7 @@ for my $url (@{$listref}) {
my $org = $event->{'organisation'};
unless ($metaref) {
# Critical if less then 24 hours left
- if ($starttime < $now + 24 * 60 * 60) {
+ if ($starttime < $now + 24 * 60 * 60) {
$retval = 2 if $retval < 2; # CRITICAL
} else {
$retval = 1 if $retval < 1; # WARNING
@@ -65,7 +67,7 @@ for my $url (@{$listref}) {
}
}
}
-print "Next few days entries are present." if ($retval == 0);
+print "Next $numdays days entries are present." if ($retval == 0);
print "\n";
exit $retval;