Module: check_mk
Branch: master
Commit: 84f1f627a86fc94c8be592ff13e477479b84b59e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=84f1f627a86fc9…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Mar 29 16:44:07 2012 +0200
New filter for services (not) contained in any aggregate
---
ChangeLog | 1 +
web/plugins/views/builtin.py | 3 ++-
web/plugins/views/filters.py | 22 ++++++++++++++++++++++
3 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 00a348e..8b36df8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,7 @@
* FIX: fix sorting of Single-Host Aggregations after group
* Avoid duplicate rule incarnations when using FOREACH_*
* BI Boxes: allow closing boxes (not yet persisted)
+ * New filter for services (not) contained in any aggregate
Checks & Agents:
* FIX: snmp_uptime handles empty snmp information without exception
diff --git a/web/plugins/views/builtin.py b/web/plugins/views/builtin.py
index 18ef366..d567fb8 100644
--- a/web/plugins/views/builtin.py
+++ b/web/plugins/views/builtin.py
@@ -1020,7 +1020,8 @@ multisite_builtin_views.update({
'service_is_flapping',
'svc_last_state_change',
'svc_last_check',
- 'siteopt'],
+ 'siteopt',
+ 'aggr_service_used'],
'sorters': [('site', False),
('site_host', False),
('svcdescr', False)],
diff --git a/web/plugins/views/filters.py b/web/plugins/views/filters.py
index 723aa03..549be57 100644
--- a/web/plugins/views/filters.py
+++ b/web/plugins/views/filters.py
@@ -541,3 +541,25 @@ class FilterLogState(Filter):
return "".join(headers) + ("Or: %d\n" % len(headers))
declare_filter(270, FilterLogState())
+
+class BIServiceIsUsedFilter(FilterTristate):
+ def __init__(self):
+ FilterTristate.__init__(self, "aggr_service_used", _("Used in BI
aggregate"), "service", None)
+
+ def filter(self, infoname):
+ return ""
+
+ def filter_table(self, rows):
+ current = self.tristate_value()
+ if current == -1:
+ return rows
+ new_rows = []
+ for row in rows:
+ is_part = bi.is_part_of_aggregation(
+ "service", row["site"],
row["host_name"], row["service_description"])
+ if (is_part and current == 1) or \
+ (not is_part and current == 0):
+ new_rows.append(row)
+ return new_rows
+
+declare_filter(300, BIServiceIsUsedFilter())