Recurring Flexible Downtime

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
tjtoml
Posts: 4
Joined: Fri Aug 09, 2024 11:23 am

Recurring Flexible Downtime

Post by tjtoml »

My org has a scheduled reboot of Windows devices on the second Tuesday - Wednesday of each month.

I was able to set up a recurring downtime for this without issue. My problem is that the downtime is currently from 5PM - 8AM the next morning - I would much rather use the Flexible Downtime feature that is available on the "Scheduled Downtime" page; 15 hours is quite a long downtime window but that's when the servers reboot.

Is there a way to create a Recurring Downtime that is flexible? Looking at /usr/local/nagiosxi/cron/recurring_downtime.php it looks like there might be a way to do this (there is a boolean fixed as a part of the array) but there is no corresponding toggle on the "Add Recurring Downtime Schedule" page in XI.

recurringdowntime.cfg:

Code: Select all

define schedule {
	sid			someuuid
	user			someuser
	comment			Patch Tuesday  - Tuesday Reboots
	time			17:00
	duration		900
	days_of_week		tue
	days_of_month		8,9,10,11,12,13,14
	months_of_year		jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec
	svcalso			1
	schedule_type		hostgroup
	hostgroup_name		windows-servers
}
danderson

Re: Recurring Flexible Downtime

Post by danderson »

Thanks for reaching out,

There isn't a way to do this currently, but I've made a feature request for you. The internal tracking number is #1414

If you really want to get this working, maybe you can try manually editing the config to look something like

Code: Select all

define schedule {
	sid			someuuid
	user			someuser
	comment			Patch Tuesday  - Tuesday Reboots
	time			17:00
	duration		900
	days_of_week		tue
	days_of_month		8,9,10,11,12,13,14
	months_of_year		jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec
	svcalso			1
	schedule_type		hostgroup
	hostgroup_name		windows-servers
	fixed			0
	flex_duration 		10
}
And then edit /usr/local/nagiosxi/cron/recurring_downtime.php changing the codeblock starting around line 384 from

Code: Select all

                $args = array(
                    'comment_data'   => $comment,
                    'comment_author' => $user,
                    'trigger_id'     => 0,
                    'start_time'     => $start_time,
                    'end_time'       => $start_time + $minutes,
                    'fixed'          => 1,
                    'duration'       => $minutes,
                    'host_name'      => $host_name
                );
to

Code: Select all

                $args = array(
                    'comment_data'   => $comment,
                    'comment_author' => $user,
                    'trigger_id'     => 0,
                    'start_time'     => $start_time,
                    'end_time'       => $start_time + $minutes,
                    'fixed'          => $r['fixed'] ?? 1,
                    'duration'       => $r['flex_duration'] * 60 ?? $minutes,
                    'host_name'      => $host_name
                );
Post Reply