Recuring Downtime for host and its services

Hey there,

i created a recuring downtime for some hosts for backup puropses. For that i edited the downtimes.conf in /etc/icinga2/conf.d/ and added

apply ScheduledDowntime "backup-downtime" to Host {
  author = "sma"
  comment = "Scheduled downtime for backup"

  child_options = DowntimeTriggeredChildren
  
  ranges = {
    monday = host.vars.backup_downtime
    tuesday = host.vars.backup_downtime
    wednesday = host.vars.backup_downtime
    thursday = host.vars.backup_downtime
    friday = host.vars.backup_downtime
    saturday = host.vars.backup_downtime
    sunday = host.vars.backup_downtime
  }

  assign where host.vars.backup_downtime != ""
}

In director i can specify to create the downtime for all services of the host and the host itself. How can i do that in my recuring downtime? Is there an option for that?

Greets
Sebbo

Hello Sebbo,

for recurring downtimes (ScheduledDowntimes) you have to configure them for host objects and for the service objects seperatly. Maybe there will be an option in the future (hint: ask for a new feature on github).

Regards,
Carsten

Hi,

I don’t think that this will happen, since the apply rule needs a scope, either to Host or to Service to know about the specific objects and their possible attributes in assign where expressions. When implementing the apply rules, we thought about such generics already, and decided against it. Technically, service apply rules would also need to Host, but since there’s only one route, this is hidden by default.

You can always put attributes into templates for instance, and only import them into apply rules, hiding duplicated parts in there.

Cheers,
Michael

1 Like

Too bad. I thought there’d be a switch, since there is a checkbox in director for that on a host object when i create a downtime manually.

The Director abstracts that and just generates the configuration in the background, it fairly looks the same as if you would write it by hand.

As said, if there’s generic content, use templates like this:

template ScheduledDowntime "backup-tmpl" {
  ranges = { 
    //...
  }
}

apply ScheduledDowntime "backup" to Host {
  import "backup-tmpl"
  assign where ...
}

apply ScheduledDowntime "backup" to Service {
  import "backup-tmpl"
  assign where ...
}

Cheers,
Michael

1 Like

Hi!
How can I create a "ScheduledDowntimeTemplate from Director - as you tell above ?
IN the director → Downtime section - Only Downtime are possible. I can’t see any TEMPLATE feature here…
In addiction how can insert\define the ranges in Downtime section of director ?
thx

Hello Michael,

thanks for your example template.

Since reducing the notification amount increases the attentiveness of the admin, we have to implement recurring downtimes for hosts and their services.

I really would like to use your template, but the director manages the config files and I don’t want to mess this up.

Where is the right place to add manual configs when using the director?

Greetings and thanks
Gabriel