"Restrict by contact groups" is AND and not OR?

Checkmk Raw Edition 2.2.0p11
RHEL9

Trying to wrap my head around notifications; specifically where I want to limit a notification rule via email contacts vs. pager contacts.

I have two contact groups, one is for users who get email only, and one is for contacts that get additional pages. I don’t want pages going out immediately on a host or service problem. I want pages to happen after emails are sent out first, and I have another rule that does that for pages via the “Restrict to notification number” rule.

If I set the notification rule to “Notify all contacts of the notified host or service”, then both contact groups get paged immediately; this is not what I want.

I thought I could solve this with the “Restrict by contact groups” rule, and only include the contact groups that get emails, and not include the groups that include pages, and vice-versa for pages.

However, it turns out that “Restrict by contact groups” is ANDed together, so only the contacts that exist in all selected groups get contacted. Could this logic be an OR instead? Or am I missing something basic when it comes to sending out delayed pages?

Yes, the selected contact groups and ANDed if you select more than one group. This is clearly stated in the inline help text of this option.

If you need an OR instead of AND, the canonical solution is to split up the notification rule into two rules, filtering on one contact group each. If I understood your use case correctly, you should succeed with three notification rules:

  1. e-mail notification to contact group A
  2. e-mail notification to contact group B
  3. pager (SMS?) notification to contact group B with a restrict to notification number setting.

However, it might be easier to choose one of these alternative solutions.

  • Put all users who want to receive e-mails into contact group A, and those who want additional pager messages also into group B. Then you need only two notification rules instead of three.
  • When creating users, enter an e-mail adress only if the user wants to receive e-mail notifications, and a pager address only if the user wants to receive pager messages. Then you need just two notification rules without filters on contact groups.

Heavy,

Thank you for your helpful response. Makes sense.

I have myself as a member of multiple contact groups. I set up a rule per contact group as you mentioned with the following filters:

  1. Notify all contacts of the notified host or service.
  2. Restrict by contact groups

I had hoped that the first filter would build up a list of contacts attached to the host or service, and the second would filter out only a singular contact group per rule to match.

However, I am notified for each contact group I’m listed in. It seems as if filter 2 populates contacts based on the contract group given in filter 2, even if filter 1 is empty.

For example, for contact groups A, B, C where USER1 is in A, B and USER2 is in B, and USER3 is in C. HOST is only attached to contact group B, C:

2023-10-21 11:38:01,310 [20] [cmk.base.notify] Analysing notification (HOST;Memory) context with 52 variables
2023-10-21 11:38:01,311 [20] [cmk.base.events] Previous service hard state not known. Allowing all states.
2023-10-21 11:38:01,312 [20] [cmk.base.notify] Global rule 'Notify all A contacts'...
2023-10-21 11:38:01,312 [20] [cmk.base.notify]  -> matches!
2023-10-21 11:38:01,312 [20] [cmk.base.notify]    - skipping contact USER2: he/she is not member of the contact group A (his groups are B)
2023-10-21 11:38:01,312 [20] [cmk.base.notify]    - skipping contact USER3: he/she is not member of the contact group A (his groups are C)
2023-10-21 11:38:01,312 [20] [cmk.base.notify]    - adding notification of USER1 via mail

2023-10-21 11:38:01,312 [20] [cmk.base.notify] Global rule 'Notify all B contacts'...
2023-10-21 11:38:01,312 [20] [cmk.base.notify]  -> matches!
2023-10-21 11:38:01,312 [20] [cmk.base.notify]    - skipping contact USER3: he/she is not member of the contact group B (his groups are C)
2023-10-21 11:38:01,312 [20] [cmk.base.notify]    - adding notification of USER1, USER2 via mail

2023-10-21 11:38:01,312 [20] [cmk.base.notify] Global rule 'Notify all C contacts on second alert'...
2023-10-21 11:38:01,312 [20] [cmk.base.notify]  -> matches!
2023-10-21 11:38:01,312 [20] [cmk.base.notify]    - skipping contact USER1: he/she is not member of the contact group C (his groups are A, B)
2023-10-21 11:38:01,312 [20] [cmk.base.notify]    - skipping contact USER2: he/she is not member of the contact group C (his groups are B)
2023-10-21 11:38:01,312 [20] [cmk.base.notify]    - adding notification of USER3 via asciimail

2023-10-21 11:38:01,313 [20] [cmk.base.notify] Executing 3 notifications:
2023-10-21 11:38:01,313 [20] [cmk.base.notify]   * would notify USER1 via mail, parameters: from, bulk_sort_order, graphs_per_notification, notifications_with_graphs, bulk: no
2023-10-21 11:38:01,313 [20] [cmk.base.notify]   * would notify USER1, USER2 via mail, parameters: from, bulk_sort_order, graphs_per_notification, notifications_with_graphs, bulk: no
2023-10-21 11:38:01,313 [20] [cmk.base.notify]   * would notify USER3 via asciimail, parameters: from, host_subject, service_subject, common_body, host_body, service_body, bulk: no

Where USER1 is notified for contact group A even though HOST is not attached to contact group A.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.