Notification Apply-Rules Issue

the following notification apply rules are falsely triggert.

I setup a kinda complex apply-rule for our notifications because we want to select on each host-template which notification should be triggert.

This apply-rule is triggert even if the host has “host.enable_notification = false” and i can’t find the error or have i discovered a bug?

The host has notifications disabled.


But the service “auto-services” is sending out notifications.


Icinga Web 2 Version: 2.8.0
Director Version: 1.6.2

I am facing the same problem, does anyone have a fix for this?

Did you disable the host notification via the configuration or via the Icinga Web 2 interface?
Imo you would have to disable it at the configuration level so that enable_notifications = false shows up in the configuration preview/file.

I disabled the notifications via Icinga2 Webinterface (toggle button) on the host itself.

please post the preview of the apply rule. In director its kinda hard to read.

And its a typo that you say:

and not “host.enable_notifications = false” ?

never used this enable_notifications thing. I use host.vars.notifications as array, where i put the types (mail,sms,etc.) in. So i apply notification where it contains “mail” f.e.

sorry “host.enable_notification” was a typo - it’s “_notifications”.

assign where host.enable_notifications && service.enable_notifications && ((service.vars["notification-contactmode"] == "merge" && ("timeperiod-5x9" in host.vars["notification-contacts"] || "timeperiod-5x9" in service.vars["notification-contacts"])) || (service.vars["notification-contactmode"] == "replace" && ((! service.vars["notification-contacts"] && "timeperiod-5x9" in host.vars["notification-contacts"]) || "timeperiod-5x9" in service.vars["notification-contacts"])))

I would like to disable service notifications when host has notification disabled - and it should be configurable for “normal” users without access to director. The simplest way seemed to me to be the “toggle button” notifications where it can be turned on and off

1 Like

Did you try what happens when you disable them in the configuration?

You mean via the config file?
Because all the hosts are created through a host-template and when i click on “modify” on a single host there is no option to disable notifications.

the togghle button also works, if you do not use

host.enable_notifications

in your apply rule. The applyrule does not overwrite that. Even without the use of enable_notifications. The apply rule is applied on reload and not changed after that. Its not dynamic.

So i can’t disable service notifications by disabling host notifications?
If the Apply-Rule doesn’t check for “host.enable_notifications or service_enable_notifications” how do check then if host has notif on/off?

No, because these are two different things.
A service belongs to a host but is a separate object.

So you can have rules (notifications apply rules e.g.) that apply to hosts but not services and vice versa.
Thats why you have to specify what the apply rule is for:
image

An apply rule for hosts does not work on services.

So if you have hosts that you don’t want to get notifications for you have 2 (or 3) choices:

  • Alter your apply rule so that the hosts are not included

  • Let the host be included in the apply rule and (temporarily) disable the notifications for the host via the icinga Web 2 toggle switch
    – this will not make your above apply rule work, because the host objects default setting for enable_notifications is true

  • Disable notifications on the config level (e.g. create a template “no-notifications” and only set enable_notifications = false)
    – this should work, because then your host will have enable_notifications = false when the config is deployed

1 Like