Module: check_mk
Branch: master
Commit: ed4eb567add4cd43cf473b7c7dadaccf22aa4c2a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ed4eb567add4cd…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sat Mar 30 10:52:46 2013 +0100
FIX: notify: fix event types and CUSTOM on old nagios cores
---
ChangeLog | 4 ++++
modules/notify.py | 10 ++++------
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1ebaca9..72c6eb9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -85,6 +85,10 @@
* FIX: check_mk_agent.freebsd: remove garble from output
(Thanks to Mathias Decker)
* check_http: now support the option -L (urlizing the result)
+
+ Notifications:
+ * FIX: fix event type for recoveries
+ * FIX: fix custom notifications on older nagios versions
Livestatus:
* FIX: memory leak when removing downtime / comment
diff --git a/modules/notify.py b/modules/notify.py
index 8dc5b80..7d19662 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -553,15 +553,13 @@ def check_notification_type(context, host_events, service_events):
if context["WHAT"] == "HOST":
allowed_events = host_events
state = context["HOSTSTATE"]
- events = { "UP" : 'u', "DOWN" : 'd' }
+ events = { "UP" : 'r', "DOWN" : 'd',
"UNREACHABLE" : 'u' }
else:
allowed_events = service_events
state = context["SERVICESTATE"]
- events = { "WARNING" : 'w', "CRITICAL" : 'c',
"UNKNOWN" : 'u' }
+ events = { "OK" : 'r', "WARNING" : 'w',
"CRITICAL" : 'c', "UNKNOWN" : 'u' }
- if notification_type == "PROBLEM":
- event = events[state]
- elif notification_type == "RECOVERY":
+ if notification_type == "RECOVERY":
event = 'r'
elif notification_type in [ "FLAPPINGSTART", "FLAPPINGSTOP",
"FLAPPINGDISABLED" ]:
event = 'f'
@@ -570,7 +568,7 @@ def check_notification_type(context, host_events, service_events):
elif notification_type == "ACKNOWLEDGEMENT":
event = 'x'
else:
- event = '?'
+ event = events.get(state, '?')
return event, allowed_events