Hello check_interval (e.g. every 5 min) and check_period are two different settings.
With the config you have posted the check should (at this time of day) show a “next check a 7:45 tomorrow”. And then it will run the check in a defined interval.
Example for setting the intervals:
Do you mean, I have to create n host-template for the n time-periods so in the host I can import the right host-template with the related timeperiod?
It’s great, you are right!
Is it still valid automatically for the apply services as well?
Because my: template Service “generic-service” { max_check_attempts = “3” check_period = “Always” check_interval = 10m retry_interval = 30s enable_perfdata = false }
if I remove check_period from generic-service, will it use the host template to calculate check_period?
oh, it it multiplies the number of service apply rules as well….
n service templates for n check_periods as well, like generic-service-24x7 or generic-service-9to5 has to be appplied
So, I have to implement them to the single service, but.. if I want a link between the service and the host I think I could do n service apply rules one to one to the n service templates for n check_periods so servapplrue24x7 with importgeneric-service-24x7 and.. as “Assign where” host.check_period ..
apply Service "Apprule-05:30-21:00 Weekend" {
import "check_period-05:30-21:00 Weekend"
check_command = "hostalive"
assign where host.check_period == "05:30-21:00 Weekend"
import DirectorOverrideTemplate
}
It feels a bit messy to do it like this…
Am I understanding it correctly?
to reduce the number of apply rules you have to create you could use the Service Set feature of the Director.
This way you create a service set for each time period that you “apply” to the hosts via the check_period. Though this mostly makes sense, if you have multiple services that you apply to the same hosts.
Another thought:
If your goal is to limit notifications to specific times, then maybe think about scheduled downtimes or limited notification periods for the checks.
Instead of “Service Apply Rules” I have to move to to service Set?
Scheduled downtimes probably is the best solution for me, so I can set ripetitive downtime i.e. every night adding an host fields like “downtime” that I can set
I am trying with scheduled downtime:
apply ScheduledDowntime “Workdays18-8” to Host {
author = “Mario”
comment = “Downtime scheduled during workdays to Downtime during the night and till saturday morning at 8:00”
fixed = true
assign where host.vars.ScheduledDowntime == “Workdays18-8”
ranges = {
“monday” = “9:30-10:30”
“monday,tuesday,wednesday,thursday,friday” = “18:00-24:00”
“monday,tuesday,wednesday,thursday,friday,saturday” = “00:00-8:00”
}