summaryrefslogtreecommitdiffstats
path: root/contrib/sched_downtime.pl
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2013-09-02 13:16:24 +0200
committerHolger Weiss <holger@zedat.fu-berlin.de>2013-09-02 13:16:24 +0200
commitb15adb7762b6caaecaa83637abfcf5fdb4802092 (patch)
tree64eddbe2aa1a7f98a140be0f7973f05d7a781ae0 /contrib/sched_downtime.pl
parentc4d5882b9e1d07c7b61091062b7d085fa5f00284 (diff)
downloadmonitoring-plugins-b15adb7762b6caaecaa83637abfcf5fdb4802092.tar.gz
Remove "contrib" plugins
These days, sites such as "Nagios Exchange" are a much better place for publishing plugins not maintained by the Plugins Development Team.
Diffstat (limited to 'contrib/sched_downtime.pl')
-rw-r--r--contrib/sched_downtime.pl47
1 files changed, 0 insertions, 47 deletions
diff --git a/contrib/sched_downtime.pl b/contrib/sched_downtime.pl
deleted file mode 100644
index b46b482c..00000000
--- a/contrib/sched_downtime.pl
+++ /dev/null
@@ -1,47 +0,0 @@
1#! /usr/bin/perl -w
2#
3# Marko Riedel, EDV Neue Arbeit gGmbH, mriedel@neuearbeit.de
4#
5#
6#
7#
8use POSIX qw(strtol);
9
10my $command_file = '/usr/local/nagios/var/rw/nagios.cmd';
11
12my $hour = (60*60);
13my $next_day = (24*60*60);
14
15my $downtimes =
16 [
17 {
18 host => 'somehost',
19 service => 'SERVICE',
20 times => [ ["00:00", 9], ["18:00", 6] ]
21 }
22 ];
23
24foreach my $entry (@$downtimes) {
25 my ($secstart, $secend, $cmd, $current);
26
27 $current = `/bin/date +"%s"`;
28 chomp $current;
29
30 foreach my $tperiod (@{ $entry->{times} }){
31 $secstart = strtol(`/bin/date -d "$tperiod->[0]" +"%s"`);
32 $secend = $secstart+$tperiod->[1]*$hour;
33
34 $secstart += $next_day;
35 $secend += $next_day;
36
37 $cmd = "[$current] SCHEDULE_SVC_DOWNTIME;";
38 $cmd .= "$entry->{host};$entry->{service};";
39 $cmd .= "$secstart;$secend;";
40 $cmd .= "1;0;$0;automatically scheduled;\n";
41
42 print STDERR $cmd;
43
44 system "echo \"$cmd\" >> $command_file";
45 }
46}
47