On Saturday 05 August 2017 at 14:44:36, Tobias Köck wrote:

> Hi,
> 
> on the page
> 
> https://www.icinga.com/docs/icinga2/latest/doc/03-monitoring-basics/#apply-
> rules
> 
> there are several confusing examples
> 
> E.g
> 
> template Notification "cust-xy-notification" {
>   users = [ "noc-xy", "mgmt-xy" ]
>   command = "mail-service-notification"
> }
> 
> apply Notification "notify-cust-xy-mysql" to Service {
>   import "cust-xy-notification"
> 
>   assign where match("*has gold support 24x7*", service.notes) &&
> (host.vars.customer == "customer-xy" || host.vars.always_notify == true)
>   ignore where match("*internal", host.name) || (service.vars.priority <
> 2 && host.vars.is_clustered == true)
> }
> 
> Somewhere else it is written that several assign/ignore where rules are
> combined with an || operator but I am especially wondering how it is
> evaluated?

Several assigns are combined with ||

Several ignores are combined with ||

That doesn't mean that an assign and an ignore are combined with ||

> If the first and second line is automatically combined with with || it
> should only match the first line. If it isn't matching the first assign
> where it shouldn't match anything else anyway?
> 
> So I don't understand why the second line (with the ignore where
> expression) is defined? If it is true that it is combined with || it
> wouldn't be added to the service anyway because there is no other assign
> where expression?

Suppose you have a machine whose service.notes include "has gold support 24x7" 
and belongs to "customer-xy", but the hostname ends in "internal".

Then the "assign where" will match, but the ignore will match as well, and my 
understanding is that the ignore will take priority, so there will be no 
notifications for internal machines.


Antony.

-- 
I want to build a machine that will be proud of me.

 - Danny Hillis, creator of The Connection Machine

                                                   Please reply to the list;
                                                         please *don't* CC me.
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to