Module: check_mk
Branch: master
Commit: df50d601cf168d32f99be628d0848eb2508d640e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=df50d601cf168d…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Apr 20 13:47:50 2015 +0200
#2207 FIX Fix exception in rule based notifiations with Nagios core and event type filter
When using Nagios as a core and the list of allowed events contains flapping
or downtime events and the previous hard state cannot correctly be determined
(due to <tt>max_check_attempts</tt> being greater as) then an exception
could have happened. This has been fixed.
---
.werks/2207 | 12 ++++++++++++
ChangeLog | 1 +
modules/notify.py | 2 +-
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/.werks/2207 b/.werks/2207
new file mode 100644
index 0000000..b4a518b
--- /dev/null
+++ b/.werks/2207
@@ -0,0 +1,12 @@
+Title: Fix exception in rule based notifiations with Nagios core and event type filter
+Level: 2
+Component: notifications
+Compatible: compat
+Version: 1.2.7i1
+Date: 1429530226
+Class: fix
+
+When using Nagios as a core and the list of allowed events contains flapping
+or downtime events and the previous hard state cannot correctly be determined
+(due to <tt>max_check_attempts</tt> being greater as) then an exception
+could have happened. This has been fixed.
diff --git a/ChangeLog b/ChangeLog
index d4b6006..be01533 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -471,6 +471,7 @@
* 2038 FIX: Log complete Email address into monitoring history when notifying
explicity addresses
* 2081 FIX: Improved logging of mkeventd in error cases
* 2193 FIX: Remove duplicate performance data from host notifications...
+ * 2207 FIX: Fix exception in rule based notifiations with Nagios core and event type
filter...
BI:
* 1784 FIX: Fix exception in BI Boxes when parents are being used
diff --git a/modules/notify.py b/modules/notify.py
index dcfd344..14c7320 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -943,7 +943,7 @@ def rbn_match_event(context, state, last_state, events,
allowed_events):
# Now go through the allowed events. Handle '?' has matching all types!
for allowed in allowed_events:
if event == allowed or \
- event[0] == '?' and event[1] == allowed[1]:
+ event[0] == '?' and len(allowed) > 1 and event[1] == allowed[1]:
return
return "Event type '%s' not handled by this rule. Allowed are: %s"
% (