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.
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
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.
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:
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