Service notifications disabled if host notification disabled

If I disable the notifications of the host, does it automatically disable alerts for notifications for services running on the host?

If not, would I do something like this?

apply Notification "mail-notify-service-corp-all" to Service {
    import "mail-notifications-service-default"

    interval = 4h
    assign where "corp" in host.groups && host.enable_notifications == "1"
    states = [ Critical, OK, Unknown, Warning ]
    types = [
    user_groups = [ "TechOps-All"]

This notification is applied to Services so checking a host's variable would be a good approach. The Notification applied to Host is not applied to Services.

When I implemented this, we got zero notifications even when the host notification was enabled.

What would be the best/easiest way? I have a team of sysadmin’s that may need to disable alerts for a bunch of hosts and those hosts services. Up till this point I’ve had to have them disable notifications on the host level, then go query all services for those hosts and disable all the services notifications. Then do the reverse when they are done.

Did you verify that host.enable_notifications is actually set to “1” where you expected it to be? It think it’s a boolean so may not be equal to the string “1”. You can use icinga2 object list to verify that the Notification was applied.

I use something similar to this:

apply Notification "My Service Notification" to Service {
  assign where "Yes Notifications" in host.groups && !("No Notifications" in host.groups || "No Notifications" in service.groups)

I based the host.enable_notifications based on querying in IcingaWeb under Overview → Hosts. When you select “Host Notifications Enabled” the acceptable values are 1 and 0, using true/false causes an error. I just tried changing the notification to use the below syntax and that seems to work. That’s very confusing where in one area true/false are the acceptable values, but 1/0 acceptable in a different area.

assign where "corp" in host.groups && host.enable_notifications == "true"

I guess I stand corrected. Using host.enable_notifications == “true” doesn’t work either.

I just set this via Director and it sets:

assign where "corp" in host.groups && host.enable_notifications
1 Like