Scheduled downtime every month time range between days

Hello everybody,

i am trying to configure the downtime.conf that way. i could configure it in the timeperiod.conf and exlude but i want to try this one.
i want that a downtime be set every month from the first until the fifth for this specific service
i could use “service.vars.backup_downtime” but at the moment i am testing and hard coding it
maybe i should try commas instead of “-” between Days ?

apply ScheduledDowntime "backup-downtime" to Service {
   author = "icingaadmin"
   comment = "Scheduled downtime for backup"
 
   ranges = {
         "january 1 - january 5" = "00:00-24:00"
         "february 1 - february 5" = "00:00-24:00"
         "march 1 - march 5" = "00:00-24:00"
         "april 1 - april 5" = "00:00-24:00"
         "may 1 - may 5" = "00:00-24:00"
         "june 1 - june 5" = "00:00-24:00"
         "july 1 - july 5" = "00:00-24:00"
         "august 1 - august 5" = "00:00-24:00"
         "september 1 - september 5" = "00:00-24:00"
         "october 1 - october 5" = "00:00-24:00"
         "november 1 - november 5" = "00:00-24:00"
         "december 1 - december 5" = "00:00-24:00"
   }
   assign where service.name == "Backup"
 }

is this even possible to be configured this way ?
did not apparently work, what am i missing ?

Thanks in Advance

I would have defined it the same way.
And it works

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

   ranges = {
         "december 1 - december 9" = "00:00-24:00"

   }
   assign where service.name == "cpu" && host.name == "ma01"
 }


apply ScheduledDowntime "backup2-downtime" to Service {
   author = "icingaadmin2"
   comment = "Scheduled another downtime for backup"

   ranges = {
         "december 10 - december 19" = "00:00-24:00"

   }
   assign where service.name == "cpu" && host.name == "ma01"
 }

today til tomorrow:
image
tomorrow til 8th:
image
10th to 11th:
image

What makes you think that it didn’t work?
Did the number of ScheduledDowntimes in the output of icinga daemon -C increase?
You might not see the downtimes in the webinterface atm, as you are past your time range.

Hello @log1c,

thank you for the Reply

yes the number of icinga2 daemon -C > Downtimes did not increase even by this range “december 1 - december 10” = “00:00-24:00”

Is it possible that you don’t have any services where service.name == "Backup" matches?

Do you see a warning message regarding your apply rule in the output of icinga2 daemon -C?

warning/ApplyRule: Apply rule 'backup-downtime'  (in  ... ) for type 'ScheduledDowntime' does not match anywhere!

The Service name Matches and the Output of icinga2 daemon -C all green without any error, nothing is missconfigured

@log1c thanks for the help and the Syntax confirmation tho

I found the problem, i had to define the Config in another zones.d and not in /etc/icinga2/conf.d

1 Like