Module: check_mk
Branch: master
Commit: 3e32f07831a7e9c32943796abb827cd355f05933
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3e32f07831a7e9…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Jun 8 17:17:00 2017 +0200
4712 FIX BI availability: Fixes bugs related to no configured BIs and BIs only showing
services
If you opened the BI availability page without having any BIs configured, an exception was
shown.
BIs only containing service states, but not the host state of the given host were
incorrectly calculated.
Change-Id: Ia7f0a8a124eb5261fd37b9079be8ca92b1f05c1b
---
.werks/4712 | 15 +++++++++++++++
web/htdocs/availability.py | 9 ++++++---
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/.werks/4712 b/.werks/4712
new file mode 100644
index 0000000..639ba66
--- /dev/null
+++ b/.werks/4712
@@ -0,0 +1,15 @@
+Title: BI availability: Fixes bugs related to no configured BIs and BIs only showing
services
+Level: 1
+Component: bi
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1496934799
+
+If you opened the BI availability page without having any BIs configured, an exception
was shown.
+
+
+BIs only containing service states, but not the host state of the services host, were
incorrectly calculated.
+
diff --git a/web/htdocs/availability.py b/web/htdocs/availability.py
index 0e02842..05932c8 100644
--- a/web/htdocs/availability.py
+++ b/web/htdocs/availability.py
@@ -1709,6 +1709,7 @@ def get_bi_leaf_history(aggr_rows, time_range, livestatus_limit):
for site, host, service in bi.find_all_leaves(tree):
by_host.setdefault(host, set([])).add(service)
host_service_info.add((host, service and service or ""))
+ host_service_info.add((host, ""))
timeline_container = TimelineContainer(row)
timeline_container.host_service_info = host_service_info
@@ -1725,7 +1726,7 @@ def get_bi_leaf_history(aggr_rows, time_range, livestatus_limit):
data = sites.live().query(query)
if not data:
- return [], None
+ return [], [], None
sites.live().set_prepend_site(False)
sites.live().set_only_sites(None)
@@ -1757,9 +1758,11 @@ def get_bi_leaf_history(aggr_rows, time_range, livestatus_limit):
return phases_list, timeline_containers, len(rows)
def compute_bi_timelines(timeline_containers, time_range, timewarp, phases_list):
- aggr_row_timelines = []
bi.load_assumptions()
+ if not timeline_containers:
+ return timeline_containers
+
def update_states(states, use_entries, phase_entries):
for element in use_entries:
hostname, svc_desc = element
@@ -1787,7 +1790,7 @@ def compute_bi_timelines(timeline_containers, time_range, timewarp,
phases_list)
# Remaining phases, may include some elements
- for from_time, phase_hst_svc in phases_list:
+ for from_time, phase_hst_svc in phases_list[1:]:
phase_keys = set(phase_hst_svc.keys())
for timeline_container in timeline_containers: