Module: check_mk
Branch: master
Commit: f7808527d309eafeb9da8be284cd0184a0fe6184
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f7808527d309ea…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Dec 19 14:06:49 2016 +0100
4155 FIX Do not perform actions on events if overflow limit is active
If the EC blocks a new event because of an active overflow limit
then it now correctly also omit any configured actions (i.e.
a notification) on that event.
Previously actions would be executed anyway - that way undermining
the overflow protection. Furthermore the action "Send notifiction"
would run into an exception because of a missing event ID.
Change-Id: I5f4f3902a336f9c635544027933f0d53e51fb359
---
.werks/4155 | 15 +++++++++++++++
ChangeLog | 1 +
bin/mkeventd | 37 +++++++++++++++++++------------------
3 files changed, 35 insertions(+), 18 deletions(-)
diff --git a/.werks/4155 b/.werks/4155
new file mode 100644
index 0000000..1d61aa7
--- /dev/null
+++ b/.werks/4155
@@ -0,0 +1,15 @@
+Title: Do not perform actions on events if overflow limit is active
+Level: 2
+Component: ec
+Compatible: compat
+Version: 1.4.0i4
+Date: 1482152679
+Class: fix
+
+If the EC blocks a new event because of an active overflow limit
+then it now correctly also omit any configured actions (i.e.
+a notification) on that event.
+
+Previously actions would be executed anyway - that way undermining
+the overflow protection. Furthermore the action "Send notifiction"
+would run into an exception because of a missing event ID.
diff --git a/ChangeLog b/ChangeLog
index eb242a5..23d9953 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,7 @@
Event Console:
* 4154 Do not send notifications if host found and currently in downtime...
NOTE: Please refer to the migration notes!
+ * 4155 FIX: Do not perform actions on events if overflow limit is active...
1.4.0i3:
diff --git a/bin/mkeventd b/bin/mkeventd
index ae6bb11..4ee5a5d 100755
--- a/bin/mkeventd
+++ b/bin/mkeventd
@@ -2177,16 +2177,14 @@ class EventServer:
else:
event["phase"] = "open"
- with lock_eventstatus:
- self.new_event_respecting_limits(event)
-
- if event["phase"] == "open":
- event_has_opened(rule, event)
- if rule.get("autodelete"):
- event["phase"] = "closed"
- log_event_history(event, "AUTODELETE")
- with lock_eventstatus:
- g_event_status.remove_event(event)
+ if self.new_event_respecting_limits(event):
+ if event["phase"] == "open":
+ event_has_opened(rule, event)
+ if rule.get("autodelete"):
+ event["phase"] = "closed"
+ log_event_history(event, "AUTODELETE")
+ with lock_eventstatus:
+ g_event_status.remove_event(event)
return
# End of loop over rules.
@@ -2704,18 +2702,21 @@ class EventServer:
# protected by lock_eventstatus
def new_event_respecting_limits(self, event):
- verbose("Checking for event limits")
+ verbose("Checking limit for message from %s (rule '%s')" % (
+ event["host"], event["rule_id"]))
- if self._handle_event_limit("overall", event):
- return
+ with lock_eventstatus:
+ if self._handle_event_limit("overall", event):
+ return False
- if self._handle_event_limit("by_host", event):
- return
+ if self._handle_event_limit("by_host", event):
+ return False
- if self._handle_event_limit("by_rule", event):
- return
+ if self._handle_event_limit("by_rule", event):
+ return False
- g_event_status.new_event(event)
+ g_event_status.new_event(event)
+ return True
# The following actions can be configured: