Modifying a recurring downtime

Hi all :slight_smile:

I found some weird behaviour with ScheduledDowntime objects and I am unsure if this is intended or not.
My downtimes are being created through apply ScheduledDowntime "my-host-downtime" to Host or apply ScheduledDowntime "my-service-downtime" to Service rules.
The actual values for these downtimes are being fed through host / service vars.

Let’s say, I have the following downtime in a specific service:
vars.downtimes = { sunday = "00:00-01:00" }

That way I have a downtime scheduled every sunday from 00:00 until 01:00. All is well.

Now, on a Monday I decide, that I would like to extend or modify that downtime by changing the vars for example to:
vars.downtimes = { saturday = "00:00-01:00" }

When I apply that configuration, I have to wait until after the next Sunday until a downtime for Saturday is being instantiated.

Is this behaviour intentional?
What would be the recommended workaround to have such a change being applied immediately?
I read somewhere that people are deleting all entries from their downtime table.


ScheduledDowntimes don’t support such dynamic tracking of changes, they rely on the fact that the configuration is static and the future ranges “stay intact”. If you need a more reliable dynamic pattern here, I’d suggest to write a small script (and crontab) which does so via the REST API - e.g. fed by a parameter for the downtime ranges. This script may also detect existing downtimes, delete them and change the desired downtime window. The logic in there is all yours :wink: