Closed notifications with Opsgenie no working

CMK Version: 2.2.0p17
OS: Ubuntu

Afternoon All,

Wondering if anyone has come across an issue with the built in Opsgenie intergration. It will open a alert but wont close the alert. Issue outlined here :- Check_MK not passing SVC_PROBLEM_ID for Close to OpsGenie notification plugin - #9 by dmatzasf

This was a older version of CheckMK, and sadly I’m a bit unsure which files need editing? Or if this will even fix this issue. Any help would be appreciated.

Thanks all :slight_smile:

Hi Deklan,

Shout out to Eric Griepsma https://forum.checkmk.com/u/egriepsma for the solution!

It would appear this has been an issue for over a year with no fix from the CMK side.
Here is what I ended up doing.

+++ lib/check_mk/notification_plugins/opsgenie_issues.py        2024-04-03 01:00:20.293262255 +0000
@@ -163,6 +163,8 @@
         desc = context.get("PARAMETER_HOST_DESC") or tmpl_host_desc
         msg = context.get("PARAMETER_HOST_MSG") or tmpl_host_msg
         alias = "HOST_PROBLEM_ID: %s" % context["HOSTPROBLEMID"]
+        if alias == 'HOST_PROBLEM_ID: 0':
+          alias = 'HOST_PROBLEM_ID: %s' % context['LASTHOSTPROBLEMID']
         ack_author = context["HOSTACKAUTHOR"]
         ack_comment = context["HOSTACKCOMMENT"]
     else:
@@ -177,6 +179,8 @@
         desc = context.get("PARAMETER_SVC_DESC") or tmpl_svc_desc
         msg = context.get("PARAMETER_SVC_MSG") or tmpl_svc_msg
         alias = "SVC_PROBLEM_ID: %s" % context["SERVICEPROBLEMID"]
+        if alias == 'SVC_PROBLEM_ID: 0':
+          alias = 'SVC_PROBLEM_ID: %s' % context['LASTSERVICEPROBLEMID']
         ack_author = context["SERVICEACKAUTHOR"]
         ack_comment = context["SERVICEACKCOMMENT"]

--- etc/nagios/conf.d/check_mk_templates.cfg.org        2024-04-03 00:02:02.013982778 +0000
+++ etc/nagios/conf.d/check_mk_templates.cfg    2024-04-03 00:04:49.521740025 +0000
@@ -355,6 +355,8 @@
        NOTIFY_LASTSERVICESTATEID='$LASTSERVICESTATEID$' \
        NOTIFY_LASTSERVICESTATECHANGE='$LASTSERVICESTATECHANGE$' \
        NOTIFY_LASTSERVICEOK='$LASTSERVICEOK$' \
+       NOTIFY_LASTHOSTPROBLEMID='$LASTHOSTPROBLEMID$' \
+       NOTIFY_LASTSERVICEPROBLEMID='$LASTSERVICEPROBLEMID$' \
        NOTIFY_SERVICEATTEMPT='$SERVICEATTEMPT$' \
        NOTIFY_SERVICESTATE='$SERVICESTATE$' \
        NOTIFY_SERVICESTATEID='$SERVICESTATEID$' \

We decided not to pick the fix in the stable releases because it could break (more) for some versions.
Fix for the upcoming 2.3 release was already published:

Thanks _rb. I did see that fix in the Beta release.
I’ll wait til it’s production for a bit.
Software, one of the few things you’ll pay for that is never complete. :smiley:

Well, there’s been a feature-complete alternative since 2009, according to some :stuck_out_tongue_winking_eye:

image