Module: check_mk
Branch: master
Commit: a17a9789f6da2684df9ae9cb01026eca34787df7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a17a9789f6da26…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Apr 8 10:02:27 2016 +0200
Avoid to show host annotations in service views multiple times
---
web/plugins/views/availability.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/web/plugins/views/availability.py b/web/plugins/views/availability.py
index 7f57dc7..187af4c 100644
--- a/web/plugins/views/availability.py
+++ b/web/plugins/views/availability.py
@@ -588,6 +588,8 @@ def render_annotations(annotations, by_host, what, avoptions,
omit_service):
return time.strftime(format, time.localtime(ts))
annos_to_render = []
+ annos_rendered = set()
+
for site_host, avail_entries in by_host.iteritems():
for service in avail_entries.keys():
site_host_svc = site_host[0], site_host[1], (service or None)
@@ -597,7 +599,9 @@ def render_annotations(annotations, by_host, what, avoptions,
omit_service):
for annotation in annotations_to_check:
if (annotation["from"] >= from_time and
annotation["from"] <= until_time) or \
(annotation["until"] >= from_time and
annotation["until"] <= until_time):
- annos_to_render.append((site_host_svc, annotation))
+ if id(annotation) not in annos_rendered:
+ annos_to_render.append((site_host_svc, annotation))
+ annos_rendered.add(id(annotation))
annos_to_render.sort(cmp=lambda a,b: cmp(a[1]["from"],
b[1]["from"]) or cmp(a[0], b[0]))