Skip to content

Instantly share code, notes, and snippets.

@ep4sh
Created July 20, 2018 10:09
Show Gist options
  • Save ep4sh/ed260bb903d9e8c472a20afb9882b09e to your computer and use it in GitHub Desktop.
Save ep4sh/ed260bb903d9e8c472a20afb9882b09e to your computer and use it in GitHub Desktop.
Icinga2 downtimes
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 != ""
}
apply Service for (disk => config in host.vars.disks) {
import "generic-service"
/* Used by the ScheduledDowntime apply rule in `downtimes.conf`. */
vars.backup_downtime = "03:00-04:30"
check_command = "by_ssh_disk"
vars += config
assign where host.vars.os == "Linux"
ignore where host.name == NodeName
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment