Derdack / derdack-plugin-checkmk

Mobile alerting with tracking, duty planning and escalation for checkmk.
2 stars 2 forks source link

derdack 1.5.0 fails on Checkmk 2.2.0p21 #2

Open gradecke opened 5 months ago

gradecke commented 5 months ago

Not sure when in 2.2 it starts but at least on 2.2.0p21 HOSTPROBLEMID is not always part of the context, so derdack should only try to pull it if the notification is for a host problem, otherwise every service notification crashes:

--- derdack.1.5.0.upstream      2024-02-07 10:41:17.520377858 +0100
+++ local/share/check_mk/notifications/derdack  2024-02-07 10:39:37.216925269 +0100
@@ -2,7 +2,7 @@
 # Enterprise Alert
 # -*- encoding: utf-8; py-indent-offset: 4 -*-

-# (c) 2021 Derdack GmbH
+# (c) 2020 Derdack GmbH
 #          Derdack Support <support@derdack.com>

 # This is free software;  you can redistribute it and/or modify it
@@ -55,8 +55,8 @@
     contact_pager = context['CONTACTPAGER'].replace(' ', '')
     description = notification_type + ' on ' + host_name
     service_problem_id = ''
+    host_problem_id = ''

-    host_problem_id = context['HOSTPROBLEMID']
     date_time = context['SHORTDATETIME']

     # Prepare Default information and Type PROBLEM, RECOVERY
@@ -74,6 +74,7 @@
     else:
         if notification_type in [ "PROBLEM", "RECOVERY" ]:
             host_state = context['HOSTSTATE']
+            host_problem_id = context['HOSTPROBLEMID']
             description += ' (' + host_state + ')'
         else:
             description += ' (' + host_state + ')'
rons4 commented 1 month ago

Thanks a lot. Should get fixed soon.