Module: check_mk
Branch: master
Commit: 66bedd26b84abd5383d5dd4441afe4026c7b11d4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=66bedd26b84abd…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Jun 26 16:31:46 2014 +0200
Sidebar snapin 'Problem hosts': Now excludes hosts and services in downtime
---
.werks/945 | 8 ++++++++
ChangeLog | 3 +++
web/plugins/sidebar/shipped.py | 12 +++++++++++-
3 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/.werks/945 b/.werks/945
new file mode 100644
index 0000000..b231127
--- /dev/null
+++ b/.werks/945
@@ -0,0 +1,8 @@
+Title: Sidebar snapin "Problem hosts": Now excludes hosts and services in
downtime
+Level: 2
+Component: multisite
+Version: 1.2.5i5
+Date: 1403792470
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index f73ccc2..90cd230 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,9 @@
* 0943 FIX: if.include: fixed incorrect traffic percentage values in the check output
of if checks...
* 0944 FIX: oracle_tablespaces: fixed calculation of space left and number of
remaining increments...
+ Multisite:
+ * 0945 FIX: Sidebar snapin "Problem hosts": Now excludes hosts and services
in downtime
+
WATO:
* 0990 FIX: Fix HTTP error handling in bulk inventory...
diff --git a/web/plugins/sidebar/shipped.py b/web/plugins/sidebar/shipped.py
index f756815..ccee448 100644
--- a/web/plugins/sidebar/shipped.py
+++ b/web/plugins/sidebar/shipped.py
@@ -192,9 +192,19 @@ def render_hosts(mode):
else:
query += "Filter: custom_variable_names < _REALNAME\n"
+ problem_hosts = []
if mode == "problems":
- query += "Filter: state > 0\nFilter: worst_service_state > 0\nOr:
2\n"
view = "problemsofhost"
+ # Exclude hosts and services in downtime
+ svc_query = "GET services\nColumns: host_name\n"\
+ "Filter: state > 0\nFilter: scheduled_downtime_depth =
0\n"\
+ "Filter: host_scheduled_downtime_depth = 0\nAnd: 3"
+ problem_hosts = set(map(lambda x: x[1], html.live.query(svc_query)))
+
+ query += "Filter: state > 0\nFilter: scheduled_downtime_depth = 0\nAnd:
2\n"
+ for host in problem_hosts:
+ query += "Filter: name = %s\n" % host
+ query += "Or: %d\n" % (len(problem_hosts) + 1)
hosts = html.live.query(query)
html.live.set_prepend_site(False)