icinga2
icinga2 copied to clipboard
ScheduledDowntime: include/exclude ranges as in TimePeriod
Scheduled downtimes for our applications are to be defined with nightly downtimes for our applications with offline window to be stored. Only for the applications with offline window - not for all service center service time applications, that would be too many.
Thereby the problem arose that it is not possible to integrate any Timeperiods and no holiday calendar can be integrated into the downtimes, as it is the case with Notifications Times and Check Periods.
The following did not work and it's really helpfull to have this feature:
apply ScheduledDowntime "MYFANCYDOWNTIME" to Service {
author = "Holy Tux"
comment = "Service center applications with offline window outside of the
the SLA times"
ranges = {
excludes = [ "T-OFF-SERVICECENTER-SERVICETIMES-15M-DELAYED"]
"monday" = "00:00-24:00"
"tuesday" = "00:00-24:00"
"wednesday" = "00:00-24:00"
"thursday" = "00:00-24:00"
"friday" = "00:00-24:00"
"saturday" = "00:00-24:00"
"sunday" = "00:00-24:00"
}
assign where ((host.vars.environment == "ENV") &&
match("FANCY_SERVICE-NAME-A*", service.name))
assign where ((host.vars.environment == "ENV") &&
match("FANCY_SERVICE-NAME-B*", service.name))
}
object TimePeriod "T-OFF-SERVICECENTER-SERVICETIMES-15M-DELAYED" {
import "legacy-timeperiod" {
excludes = [ "T-SERVICECENTER-SERVICETIMES-15M-DELAYED" ]
display_name = "Offline time off applications for ServiceCenter
working hours with 15m delayed start"
ranges = {
ranges = {
"monday" = "00:00-24:00"
"tuesday" = "00:00-24:00"
"wednesday" = "00:00-24:00"
"thursday" = "00:00-24:00"
"friday" = "00:00-24:00"
"saturday" = "00:00-24:00"
"sunday" = "00:00-24:00"
}
}
Error message:
[YYYY-MM-DD hh:mm:ss +0000] critical/config: Error: Validation failed
for object 'DUMMYHOSTL!FANCY_SERVICE-NAME-A!MYFANCYDOWNTIME' of type
'ScheduledDowntime'; attribute 'ranges' -> 'excludes': Invalid type.