I’m trying to apply a notification rule to services if they have a specific variable configured:
// Notification level 3: configured through 'notification_level' service var == 3
apply Notification "notification-level-3" to Service {
import "mail-service-notification"
user_groups = "notification-group-level-3"
interval = 12h
// Rewrite states if declared into service
if (service.vars.notification_states) {
states = service.vars.notification_states
}
assign where service.vars.notification_level == "3"
//assign where host.vars.notification.mail
}
I have a service with notification_level = "3"
:
object Zone "www1.local.domain" {
endpoints = [ "www1.local.domain" ]
parent = "monitoring.local.domain"
}
object Endpoint "www1.local.domain" {
host = "123.123.123.123"
}
object Host "www1.local.domain" {
import "generic-host"
address = "123.123.123.123"
vars.os = "Windows"
vars.distro = "Microsoft Windows Server 2019 Standard"
vars.notification["mail"] = {
groups = [ "icingaadmins" ]
}
vars.client_endpoint = name
vars.http_vhosts["IIS HTTP Service"] = {
http_uri = "/"
}
vars.http_vhosts["IIS Site www.mysite.com"] = {
http_address = "123.123.123.124"
http_vhost = "www.mysite.com"
http_uri = "/"
notification_level = 3
}
}
I’m expecting that the IIS Site www.mysite.com check would have the notification-group-level-3 added to notification users, but it only has the default icingaadmins group:
Could you help me to understand where I’m wrong please?
Thank you!