Module: check_mk
Branch: master
Commit: 66e2e1d254c95c8454a8374c8fc867ff9a97810f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=66e2e1d254c95c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Apr 23 10:07:43 2014 +0200
BI: speedup availability computation
---
web/plugins/views/availability.py | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/web/plugins/views/availability.py b/web/plugins/views/availability.py
index 5a60a48..817522b 100644
--- a/web/plugins/views/availability.py
+++ b/web/plugins/views/availability.py
@@ -1422,9 +1422,22 @@ def get_bi_timeline(tree, aggr_group, avoptions, timewarp):
"Columns: " + " ".join(columns) + "\n" +\
"Filter: time >= %d\nFilter: time <= %d\n" % range
- for host in hosts:
+ # Create a specific filter. We really only want the services and hosts
+ # of the aggregation in question. That prevents status changes
+ # irrelevant services from introducing new phases.
+ by_host = {}
+ for site, host, service in bi.find_all_leaves(tree):
+ by_host.setdefault(host, set([])).add(service)
+
+ for host, services in by_host.items():
query += "Filter: host_name = %s\n" % host
- query += "Or: %d\n" % len(hosts)
+ query += "Filter: service_description = \n"
+ for service in services:
+ query += "Filter: service_description = %s\n" % service
+ query += "Or: %d\nAnd: 2\n" % (len(services) + 1)
+ if len(hosts) != 1:
+ query += "Or: %d\n" % len(hosts)
+
data = html.live.query(query)
if not data:
raise MKGeneralException(_("No historical data available for this
aggregation. Query was: <pre>%s</pre>") % query)