Notification arrives two times

Hello everyone,

last week I got an idea for my checkMK to receive notivications via Discord. After a bit of searching, I found a Github file that fitted completly. https://gist.github.com/n00rm/32f1334b1dd2efc40122fee36551ef17

So after setting everything up I noticed, that I receive the SAME Notifications two times:

grafik

A bit irritated I set up a second CheckMK just to make sure my current System has any mistakes. But nope, still the same. Could it be that the two spool files are causing this issue? Because this is what I found in the logs /var/log/notify.log:

2021-06-14 11:12:58,985 [20] [cmk.base.notify] Global rule 'Notify all contacts of a host/service via HTML email'...
2021-06-14 11:12:58,985 [20] [cmk.base.notify]  -> matches!
2021-06-14 11:12:58,985 [20] [cmk.base.notify]    - adding notification of cmkadmin via mail
2021-06-14 11:12:58,986 [20] [cmk.base.notify] Executing 2 notifications:
2021-06-14 11:12:58,986 [20] [cmk.base.notify]   * notifying cmkadmin via mail, parameters: host_subject, from, service_subject, graphs_per_notification, notifications_with_graphs, bulk: no
2021-06-14 11:12:58,986 [20] [cmk.base.notify] Creating spoolfile: /omd/sites/monitor/var/check_mk/notify/spool/4a8dec41-16ae-4f4e-9e7a-7e5e52e4e8af
2021-06-14 11:12:58,990 [20] [cmk.base.notify]   * notifying cmkadmin, automation via discord.py, parameters: https://discordapp.com/api/webhooks/, bulk: no
2021-06-14 11:12:58,990 [20] [cmk.base.notify] Creating spoolfile: /omd/sites/monitor/var/check_mk/notify/spool/8c8ada2c-c3a6-4a7d-8fbc-960135841cea
2021-06-14 11:12:58,993 [20] [cmk.base.notify] Creating spoolfile: /omd/sites/monitor/var/check_mk/notify/spool/44c3739a-d656-4657-8153-fa3caea403b3
2021-06-14 11:13:03,855 [20] [cmk.base.notify] ----------------------------------------------------------------------
2021-06-14 11:13:03,855 [20] [cmk.base.notify] Got spool file 4a8dec41 (apache.i.3fu.de;Check_MK) for local delivery via mail
2021-06-14 11:13:03,867 [20] [cmk.base.notify] ----------------------------------------------------------------------
2021-06-14 11:13:03,868 [20] [cmk.base.notify] Got spool file 8c8ada2c (apache.i.3fu.de;Check_MK) for local delivery via discord.py
2021-06-14 11:13:03,869 [20] [cmk.base.notify]      executing /omd/sites/monitor/share/check_mk/notifications/mail
2021-06-14 11:13:03,885 [20] [cmk.base.notify]      executing /omd/sites/monitor/local/share/check_mk/notifications/discord.py
2021-06-14 11:13:04,873 [20] [cmk.base.notify]      Output: Spooled mail to local mail transmission agent
2021-06-14 11:13:05,731 [20] [cmk.base.notify] ----------------------------------------------------------------------
2021-06-14 11:13:05,732 [20] [cmk.base.notify] Got spool file 44c3739a (apache.i.3fu.de;Check_MK) for local delivery via discord.py
2021-06-14 11:13:05,732 [20] [cmk.base.notify]      executing /omd/sites/monitor/local/share/check_mk/notifications/discord.py
2021-06-14 11:13:47,902 [20] [cmk.base.notify] ----------------------------------------------------------------------
2021-06-14 11:13:47,903 [20] [cmk.base.notify] Got raw notification (apache.i.3fu.de;Check_MK) context with 71 variables
2021-06-14 11:13:47,903 [20] [cmk.base.notify] Global rule ''...
2021-06-14 11:13:47,903 [20] [cmk.base.notify]  -> matches!
2021-06-14 11:13:47,903 [20] [cmk.base.notify]    - adding notification of cmkadmin, automation via discord.py
2021-06-14 11:13:47,903 [20] [cmk.base.notify] Global rule 'Notify all contacts of a host/service via HTML email'...
2021-06-14 11:13:47,903 [20] [cmk.base.notify]  -> matches!
2021-06-14 11:13:47,904 [20] [cmk.base.notify]    - adding notification of cmkadmin via mail
2021-06-14 11:13:47,904 [20] [cmk.base.notify] Executing 2 notifications:
2021-06-14 11:13:47,904 [20] [cmk.base.notify]   * notifying cmkadmin via mail, parameters: host_subject, from, service_subject, graphs_per_notification, notifications_with_graphs, bulk: no
2021-06-14 11:13:47,904 [20] [cmk.base.notify] Creating spoolfile: /omd/sites/monitor/var/check_mk/notify/spool/b6ae10ba-7946-4eb9-924f-cd352aa484ec
2021-06-14 11:13:47,907 [20] [cmk.base.notify]   * notifying cmkadmin, automation via discord.py, parameters: https://discordapp.com/api/webhooks/e, bulk: no
2021-06-14 11:13:47,907 [20] [cmk.base.notify] Creating spoolfile: /omd/sites/monitor/var/check_mk/notify/spool/5b2789c4-8f33-47dd-b16d-717a26df13a6
2021-06-14 11:13:47,911 [20] [cmk.base.notify] Creating spoolfile: /omd/sites/monitor/var/check_mk/notify/spool/caca2761-059e-4ff8-8c76-bebe6326670a
2021-06-14 11:13:53,200 [20] [cmk.base.notify] ----------------------------------------------------------------------
2021-06-14 11:13:53,201 [20] [cmk.base.notify] Got spool file 5b2789c4 (apache.i.3fu.de;Check_MK) for local delivery via discord.py
2021-06-14 11:13:53,202 [20] [cmk.base.notify]      executing /omd/sites/monitor/local/share/check_mk/notifications/discord.py
2021-06-14 11:13:53,526 [20] [cmk.base.notify] ----------------------------------------------------------------------
2021-06-14 11:13:53,527 [20] [cmk.base.notify] Got spool file b6ae10ba (apache.i.3fu.de;Check_MK) for local delivery via mail
2021-06-14 11:13:53,545 [20] [cmk.base.notify]      executing /omd/sites/monitor/share/check_mk/notifications/mail
2021-06-14 11:13:56,371 [20] [cmk.base.notify] ----------------------------------------------------------------------
2021-06-14 11:13:56,372 [20] [cmk.base.notify] Got spool file caca2761 (apache.i.3fu.de;Check_MK) for local delivery via discord.py
2021-06-14 11:13:56,385 [20] [cmk.base.notify]      executing /omd/sites/monitor/local/share/check_mk/notifications/discord.py
2021-06-14 11:13:59,253 [20] [cmk.base.notify]      Output: Spooled mail to local mail transmission agent
2021-06-14 11:45:38,341 [20] [cmk.base.events] Configuration has changed. Restarting myself.

And my python skills are not advanced enough to find out, why this happens. Does anybody got an idea?

Cheers,
Gamie

(Don’t be suprised about different time stamps and server settings, Didn’t hat the logs from the notification of the screenshot)

I think the problem is that you get here two users who should be notified via Discord.
As this scripts don’t knows anything about the user it is called for you should pay attention that it is only called for one user.

1 Like

Oh you found my shitty discord script :sweat_smile:

The script itself works fine but @andreas-doehler is complety right. Please adjust your notification rule that it’s only called for the automation user. I just tested it and it works fine for me. Sorry for not responding to you on github yet. I was busy watching the Checkmk Conference :sweat_smile: :beers:

2 Likes

Everyday I learn something new …

@andreas-doehler @Norm Thank you very very much! Now It’s working as intented :slight_smile:

Oh you found my shitty discord script

Why does a lot of dev talk like that of their code? :sweat_smile: I was really happy to find that. And no worries about the missing answer :smiley: I didn’t saw that you’re active here as well :smiley:

1 Like

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.