Number of Notification sent out

CMK version: Community 2.4.0p24
OS version: ubunt 24.04

Hi All,

I have a issue with the notification rule. I am using my script checkmk_call to forward all the notification to my program for centralized notification. I have created a contact group which include me and my teammate andy. I tried both ways, either use specific users or contact groups, in both ways the checkmk will send out 2 notification to my program, I thought that if I use contact group then it should only send out once (although there is a warning says “Select one user from a contact group with access to all hosts and services. This will prevent duplicate notifications, as selecting multiple users will trigger separate notifications” ). Also, in both ways the email I receive only have my email address but not my teammate, i am expecting both email addresses in the contact group will be shown. It seems the contact group doesn’t work as it should. Please give some help. Thanks

u do not include sensitive data in the post. Please avoid sharing data like:

  • Internal IP addresses/ URLs
  • Passwords, API keys and tokens, private SSH keys
  • Database connection strings, including hostnames, ports, and credentials etc
    →
1 Like

I would guess your script checkmk_call gets called twice but with different values of NOTIFY_CONTACTALIAS, NOTIFY_CONTACTEMAIL and NOTIFY_CONTACTNAME. Once for your user and once for Andy:

I setup a test site with cmkadmin and a second user (ntest). Then I added a notification script that simply dumps all environment variables (with the notification data) to temporary files. Something like this:

#!/bin/sh
# Notification Inspector (save environment to ~/tmp)

env | sort > $OMD_ROOT/tmp/notify-env-${NOTIFY_CONTACTNAME}.out
exit 0;

When I trigger an alarm, the script writes two files for the two users I configured in the notification rule. The two files only differ in the above mentioned variables:

OMD[cmk]:~/tmp$ diff -u notify-env-cmkadmin.out notify-env-ntest.out
-NOTIFY_CONTACTALIAS=cmkadmin
-NOTIFY_CONTACTEMAIL=cmkadmin@...
-NOTIFY_CONTACTNAME=cmkadmin
+NOTIFY_CONTACTALIAS=Test User
+NOTIFY_CONTACTEMAIL=ntest@...
+NOTIFY_CONTACTNAME=ntest

If the script would send emails to the $NOTIFY_CONTACTEMAIL then this would be perfectly okay because then each user would get their own email. But if the script would write syslog messages (for example) there would always be duplicates.

Did you take that behaviour into account?

1 Like

Yes, understand this is the behaviour it does now,when we use script, if there are 2 receipient then checkmk will call the script twice, but this is what we want to change, we just want checkmk to call the script once with both recipient emails consolidated in one notification. We think if we are not using the script but simply use the default checkmk notification logic, checkmk will consolidate all the recipient into one notification and send out, that’s why we can see all the recipient in the email’s "‘To” field’, but with script, checkmk does not do the consolidation wokr but simply call twice with each recipient separately.

Ah, now I see what you mean. I tested with checkmk 2.3 and you are using 2.4. They changed the notification system significantly with 2.4 and maybe that makes the difference. I’m sorry.
Indeed, with 2.4 my script gets called twice (as expected) but if I activate the email notification instead, I get an email with two recipients (which surprises me). :person_shrugging: