Module: check_mk
Branch: master
Commit: da262ee9535c6fd7c4a1a5cf2d8a16e4be084f0d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=da262ee9535c6f…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Thu Jan 25 09:29:25 2018 +0100
5491 FIX Show failed host notifications in tactival overview
Due to an error in a livestatus query only failed service
notificaitons were shown.
Change-Id: I0afa86d81182c9e31e78df564467141d1cad01fd
---
.werks/5491 | 11 +++++++++++
web/htdocs/notifications.py | 32 ++++++++++++++++----------------
2 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/.werks/5491 b/.werks/5491
new file mode 100644
index 0000000..dc64ea3
--- /dev/null
+++ b/.werks/5491
@@ -0,0 +1,11 @@
+Title: Show failed host notifications in tactival overview
+Level: 1
+Component: notifications
+Compatible: compat
+Edition: cre
+Version: 1.5.0i3
+Date: 1516868860
+Class: fix
+
+Due to an error in a livestatus query only failed service
+notificaitons were shown.
diff --git a/web/htdocs/notifications.py b/web/htdocs/notifications.py
index a750d84..f9c86df 100644
--- a/web/htdocs/notifications.py
+++ b/web/htdocs/notifications.py
@@ -97,31 +97,31 @@ def load_failed_notifications(before=None, after=None,
stat_only=False, extra_he
if not may_see_notifications:
return [0]
- query_filters = [
- "class = 3",
- "log_type = SERVICE NOTIFICATION RESULT",
- ]
+ query = ["GET log"]
+ if stat_only:
+ query.append("Stats: log_state != 0")
+ else:
+ query.append("Columns: %s" % " ".join(g_columns))
+ query.append("Filter: log_state != 0")
+
+ query.extend([
+ "Filter: class = 3",
+ "Filter: log_type = SERVICE NOTIFICATION RESULT",
+ "Filter: log_type = HOST NOTIFICATION RESULT",
+ "Or: 2",
+ ])
if before is not None:
- query_filters.append("time <= %d" % before)
+ query.append("Filter: time <= %d" % before)
if after is not None:
- query_filters.append("time >= %d" % after)
+ query.append("Filter: time >= %d" % after)
if may_see_notifications:
if config.user.may("general.see_failed_notifications"):
horizon = config.failed_notification_horizon
else:
horizon = 86400
-
- query_filters.append("time > %d" % (int(time.time()) - horizon))
-
- query = ["GET log"]
- if stat_only:
- query.append("Stats: log_state != 0")
- else:
- query.append("Columns: %s" % " ".join(g_columns))
- query_filters.append("log_state != 0")
- query += ["Filter: %s" % filt for filt in query_filters]
+ query.append("Filter: time > %d" % (int(time.time()) - horizon))
query = "\n".join(query)