Disable Notification for specific Service (Environment)

Hi,
I monitored 3 Environment (Development, Staging and Production).
But I don’t want to get Service Notification (Mail, SMS etc) from the Development. This Env should only be displayed on the Webpage and should sent Notification when a Host is not available.
My template looks like this but is not working I expect :frowning:
Someone an idea?

template Service “generic-service” {
max_check_attempts = 5
check_interval = 1m
retry_interval = 15s
if (vars.stage == “development”) {
enable_notifications = false
} else {
enable_notifications = true
}

Hi,

where is the stage custom variable defined? If that’s on the host level, you can control that via service apply rules like so:

apply Service "..." {

  if (host.vars.stage == "development") {
    enable_notifications = false
  } else {
    enable_notifications = true
  }

  //...
}

Cheers,
Michael

Hi Michael,
yes the stage is defined on the host level and your hint works well now.
Thanks a lot :smile: