I think I didn’t write the right example.
I don’t want to use the variable notifications under hosts but disable services notifications IF enable_notifications = false UNDER the host…
it’s for a variable under the host and we are not having one, so using your “and” disable notification for all services for any hosts instead of for the host that have notification disable as our “template”
We would need something that can check if enable_notifications = 0 under
the host definition and then, do the same thing under “services”
Those are exactly the examples I gave you.
Here are the first and last lines of each:
apply Notification “mail-host-notification” to Host {
…
assign where host.vars.notifications != 0
}
apply Notification “mail-service-notification” to Service {
…
assign where host.vars.notifications != 0
}
Is there a way to know the status of the “enable_notifications” under a
host?
Yes. Service checks can test host variables, as shown above.
Have you actually tried one of the examples I’ve given, and found a problem
with it, or do you just think it won’t do what you want (possibly because of a
misunderstanding on my part)?