Downtime scheduling

Hi All,

We have a particular service in our env that we know off will spike some service alerts we have tried this. to mitigate the alerts:

"monday" = "00:00-07:00,09:00-11:00,12:00-19:00,20:00-21:00"

But it seems its too much for icinga.

reducing it back to two time slots its seems to be picked up nicely.
"monday" = "00:00-07:00,12:00-19:00"

Now i know about this:

Icinga 2 attempts to find the next possible segment from a ScheduledDowntime object’s ranges attribute, and wont create multiple downtimes in the future. In case you need all these downtimes planned and visible for the next days, weeks or months, schedule them manually via the REST API using a script or cron job.

Fount here: (link)

But how much “attempt” / effort is given to this. as with more than 2 time slots it seems to skip a few, and does not “behave” like you would expect it too.

In case you are wondering we apply it in this manner:

template ScheduledDowntime "namehere" {
  ranges = {
    "monday"    = "00:00-07:00,12:00-19:00"
    "tuesday"   = "00:00-07:00,12:00-19:00"
    "wednesday" = "00:00-07:00,12:00-19:00"
    "thursday"  = "00:00-07:00,12:00-19:00"
    "friday"    = "00:00-07:00,12:00-19:00"
    "saturday"  = "00:00-07:00,12:00-19:00"
    "sunday"    = "00:00-07:00,12:00-19:00"
apply ScheduledDowntime "downtime" to Service {
  import "namehere"
  author = "ic2_admin"
  comment = "Scheduled downtime"
  assign where "wcpu" in service.groups && host.vars.client == "client" && host.vars.dt == "enabled"

I have never tried something like that.
Have you checked/validated that the services are not in a downtime in the given timeframes?

If they really are not I would suggest you create an issue on github for this case.
You will most likely get a faster answer from the devs there then here :slight_smile:

I’m not sure if the problem is with the downtime object or with the more than two time periods.
You could try “reversing” your times and use them for a notification time period to only send notifications in the “not-downtime” times and see if that works.
"monday" = "07:00-08:59,11:00-11:59,19:00-19:59,21:00-23:59"

Yeah I check quite a lot for the 4 timeframes,
but sometimes it works and sometimes it does not as icinga attempts

So I was wondering what this could be :slight_smile:

Reversing is a interesting option to try!