Module: check_mk
Branch: master
Commit: 2e6d46a84ee96e7795953abad4499533cb6d5a3e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2e6d46a84ee96e…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Aug 4 11:14:15 2016 +0200
3713 new filter: hosts with certain service problems
---
.werks/3713 | 9 +++++++++
ChangeLog | 1 +
web/plugins/visuals/filters.py | 30 ++++++++++++++++++++++++++++++
3 files changed, 40 insertions(+)
diff --git a/.werks/3713 b/.werks/3713
new file mode 100644
index 0000000..4efb72d
--- /dev/null
+++ b/.werks/3713
@@ -0,0 +1,9 @@
+Title: new filter: hosts with certain service problems
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.4.0i1
+Date: 1470302026
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 85510f9..f49f6fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -346,6 +346,7 @@
* 3592 Views: Added sorter for host names (without site)
* 3141 added user interfaces and permissions to view and acknowledge failed
notifications
* 3640 new filter option for status details: can now be negated
+ * 3713 new filter: hosts with certain service problems
* 3059 FIX: Fixed highlighting of availability timeline time slices
* 3175 FIX: Fix timeranges of graphs that are embedded in a dashboard...
* 3076 FIX: fixed broken views in check_mk raw edition
diff --git a/web/plugins/visuals/filters.py b/web/plugins/visuals/filters.py
index 6e1e83e..8f89447 100644
--- a/web/plugins/visuals/filters.py
+++ b/web/plugins/visuals/filters.py
@@ -523,7 +523,37 @@ class FilterHostState(Filter):
declare_filter(115, FilterHostState())
+class FilterHostsHavingServiceProblems(Filter):
+ def __init__(self):
+ Filter.__init__(self, "hosts_having_service_problems",
+ _("Hosts having certain service problems"), "host",
+ ["hosts_having_services_warn",
"hosts_having_services_crit",
+ "hosts_having_services_pending",
"hosts_having_services_unknown"], [])
+
+ def display(self):
+ html.begin_checkbox_group()
+ for var, text in [
+ ("warn", _("WARN")),
+ ("crit", _("CRIT")),
+ ("pending", _("PEND")),
+ ("unknown", _("UNKNOWN")), ]:
+ html.checkbox("hosts_having_services_%s" % var, True, label=text)
+ html.end_checkbox_group()
+
+ def filter(self, infoname):
+ headers = []
+ for var in [ "warn", "crit", "pending",
"unknown" ]:
+ if html.get_checkbox("hosts_having_services_%s" % var) == True:
+ headers.append("Filter: num_services_%s > 0\n" % var)
+
+ len_headers = len(headers)
+ if len_headers > 0:
+ headers.append("Or: %d\n" % len_headers)
+ return "".join(headers)
+ else:
+ return ""
+declare_filter(120, FilterHostsHavingServiceProblems())
class FilterTristate(Filter):
def __init__(self, name, title, info, column, deflt = -1):