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 (r2.4.1-1 on opensuse 42.1).

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 != ""

Somebody an idea? Thanks


You could assign the service.vars.backup_downtime value "22:00-24:00,00:00-05:00" so that you get downtime from 22:00 to 05:00 the next day.

ie. service definition will be:

apply Service "foo" {
  display_name = "foo process"
  import "generic-service"
  check_command = "foo-process"
  command_endpoint = host.address
  vars.backup_downtime = "22:00-24:00,00:00-05:00"
  assign where host.vars.type == "bar"
  • 1
    This was exactly was I was looking for but didn't manage to find in the docs. Seems to be working! Thanks a lot! – B. Walger Feb 5 '16 at 15:58
  • No problem mate. – 7171u Feb 5 '16 at 16:32

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.