I'm trying to send different notifications in different time periods, basically I want to send all notifications during work hours, but only notifications for hosts marked emergency during off hours.
apply Notification "mike-on" to Host {
import "mail-host-notification"
users = [ "sms" ]
period = "mikehours"
assign where host.vars.notification.mail
}
apply Notification "mike-off" to Host {
import "mail-host-notification"
users = [ "sms" ]
period = "nonmikehours"
assign where host.vars.emergency == true
}
sms is simply a contact with the email set to [email protected], and the time periods are defined as follows
object TimePeriod "mikehours" {
import "legacy-timeperiod"
display_name = "Mike's work hours"
ranges = {
"monday" = "06:00-23:00"
"tuesday" = "06:00-23:00"
"wednesday" = "06:00-23:00"
"thursday" = "06:00-23:00"
"friday" = "06:00-23:00"
"saturday" = "07:00-22:00"
"sunday" = "07:00-22:00"
}
}
object TimePeriod "nonmikehours" {
import "legacy-timeperiod"
display_name = "Mike's off hours"
ranges = {
"monday" = "00:00-06:00,23:00-24:00"
"tuesday" = "00:00-06:00,23:00-24:00"
"wednesday" = "00:00-06:00,23:00-24:00"
"thursday" = "00:00-06:00,23:00-24:00"
"friday" = "00:00-06:00,23:00-24:00"
"saturday" = "00:00-07:00,22:00-24:00"
"sunday" = "00:00-07:00,22:00-24:00"
}
}
However, I still receive all notifications via sms even outside of the specified work hours.