I have a dummy service set up to receive results of a daily cron job (runs at 02:00). It’s not a critical cron job, so I have the check_period set to between 09:00-09:15. During this time period, I would expect the service state to change to unknown if the cron job has failed to report its results (no updates in 24 hours), and to send a notification if required if the cron job results are critical or warning. Below are my objects. It doesn’t seem to be performing as expected, so I’m thinking my understanding may be wrong:
object TimePeriod "0900to0915" {
display_name = "Icinga 2 0900to0915 TimePeriod"
ranges = {
"monday" = "09:00-09:15"
"tuesday" = "09:00-09:15"
"wednesday" = "09:00-09:15"
"thursday" = "09:00-09:15"
"friday" = "09:00-09:15"
"saturday" = "09:00-09:15"
"sunday" = "09:00-09:15"
}
}
template Service "generic-service" {
max_check_attempts = 5
check_interval = 1m
retry_interval = 30s
enable_perfdata = false
}
apply Service "check_something" {
import "generic-service"
check_command = "dummy"
display_name = "Cron: check_something"
enable_active_checks = true
enable_passive_checks = true
check_interval = 24h
retry_interval = 24h
max_check_attempts = 1
check_period = "0900to0915"
vars.notifications = ["someteam"]
vars.dummy_state = 3
vars.dummy_text = {{
var service = get_service(macro("$host.name$"), macro("$service.name$"))
var lastCheck = DateTime(service.last_check).to_string()
return "No check results received." + "\n" + "\n" + "Check logs at `/var/log/icinga_send_result/`." + "\n" + "Check team email for any errors."
}}
assign where "role" in host.vars.roles
}
Any suggestions on correcting this?