How to set icinga2 backup-downtime across midnight?

Our backup is running between 22:00 and about 05:00 the next day. I could not figure out how to set this in a scheduled downtime with “apply ScheduledDowntime” in icinga2.
Just setting 22:00-05:00 gives me an error:

Invalid time range definition ‘22:00-05:00’: Time period segment ends before it begins
The current mechanism uses a service variable backup_downtime which in turn triggers the “apply” rule when not empty:

apply ScheduledDowntime "backup-downtime" to Service {
  author = "icingaadmin"
  comment = "Scheduled downtime for backup"

  ranges = {
    monday = service.vars.backup_downtime
    tuesday = service.vars.backup_downtime
    wednesday = service.vars.backup_downtime
    thursday = service.vars.backup_downtime
    friday = service.vars.backup_downtime
    saturday = service.vars.backup_downtime
    sunday = service.vars.backup_downtime
  assign where service.vars.backup_downtime != ""

By viewing the existing icinga2 documentation(,I know that we can set multiple backup_downtime.
For example,

apply Service "two_replication_test" {
    max_check_attempts = 1
    check_interval = 1m
    retry_interval = 30s
    check_command = "check_gerrit_replication"
    vars.notification_interval.mail = 30m
    vars.backup_downtime = "22:00-24:00,00:00-05:00"
    vars.gerrit_notification["mail"] = {
      users = [ "liuyana" ]
    assign where == "gerrit-host"

However, this did not work as I expected, only during the 00:00-05:00, the notifications were suppressed. Somebody an idea? Thanks

Use ‘22:00-29:00’ , works perfect.

Will be fixed with 2.11, the issue mentions a workaround in the docs.

1 Like

How long will backupdowntime take effect?
I found that it wont take effect immediately, when i set the new backup downtime and reload icinga2.
And i don’t know when it will take effect.
Where can I find the docs about the execution process of backup downtime?

I adjusted the time from “22::00-24:00" to '22:00-29:00’, and reload icinga2.
However, i found this backuptime dont take effect immediately. And, i dont know when it will take effect.What else can I do?

the config of service:
apply Service “A available ratio” {
import “search-service”
vars.tsd_metric = “search.blender.resp.ok.ratio”
vars.tsd_method = “lt”
vars.tsd_aggregator = “min”
vars.tsd_warning = “0.98”
vars.tsd_breaktimes = “3”
vars.tsd_tags += [ “env=a”,“cluster=literal_or(lf|ht)” ]
vars.tsd_duration = “195”
vars.backup_time = “09:00-10:00”
vars.search_notification.first.mail.groups += [ “sd_ops_search” ]
vars.search_notification.first.sms.groups += [ “sd_ops_search” ]
vars.search_notification.first.timline.groups += [ “sd_ops_search” ]
vars.tsd_downsample = “avg”
vars.tsd_downsample_window = “31”

assign where == “search-host”

and start icinga2. Five minutes later i check the ‘’‘icinga2 object list --type downtime’’’.
No content returned

That’s not an accurate check since the cache for object list only is written upon restart or config validation. Downtimes are runtime created objects, and as such, need to be queried via REST APi at /v1/objects/downtimes.