Daily Scheduled Downtime?


#1

Is there a way to schedule downtime for hosts on a daily basis? I have some servers that reboot every night at 3a.m. but I dont want to get paged every night when they go down and come back up. Any help is appreciated, and thanks for your guys help in the past …this forum is awesome!!!


#2

It’s not the the answer to what you asked but…
you could define different timeperiods where you have nobody getting notified between 03:00 and 03:10. Downside is if another server goes down and you don’t have multiple notifications you could miss this one… solution could be using a different user for these servers…

Hope it helps.

Luca


#3

I wrote a script to do just that!


#!/bin/sh
start=date +%s
nagioslog=/usr/local/nagios/var/nagios.log
downlog=/usr/local/nagios/var/downtime.log
nagiosdownlog=/root/scripts/nagiosdowntime.log

host=$1
service=$2
duration=$3
comment=$4

end=$(($start + $duration))
count=$((grep -c "\" $downlog + 1))

echo “$start] SERVICE_DOWNTIME;$count;$host;$service;$start;$end;1;$duration;$USER;$comment” >> $downlog
echo “$start] EXTERNAL COMMAND: SCHEDULE_SVC_DOWNTIME;$host;$service;$start;$end;1;$duration;$USER;$comment” >> $nagioslog
echo “” date “] SERVICE_DOWNTIME started for the $service service on $host for a duration of $duration seconds by $USER: “$comment”” >> $nagiosdownlog

/etc/init.d/nagios reload


#4

I wrote a script to do just that!


#!/bin/sh
start=date +%s
nagioslog=/usr/local/nagios/var/nagios.log
downlog=/usr/local/nagios/var/downtime.log
nagiosdownlog=/root/scripts/nagiosdowntime.log

host=$1
service=$2
duration=$3
comment=$4

end=$(($start + $duration))
count=$((grep -c "\" $downlog + 1))

echo “$start] SERVICE_DOWNTIME;$count;$host;$service;$start;$end;1;$duration;$USER;$comment” >> $downlog
echo “$start] EXTERNAL COMMAND: SCHEDULE_SVC_DOWNTIME;$host;$service;$start;$end;1;$duration;$USER;$comment” >> $nagioslog
echo “” date “] SERVICE_DOWNTIME started for the $service service on $host for a duration of $duration seconds by $USER: “$comment”” >> $nagiosdownlog

/etc/init.d/nagios reload


#5

nagiosexchange.org/Downtimes.38.0.html