Module: check_mk
Branch: master
Commit: 07b01a515777a549ba573be960a47be94f06a24a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=07b01a515777a5…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri May 27 13:29:34 2016 +0200
3614 FIX Outage statistics for hosts now also work in PDF reports
If you created a PDF report containing an availability table of hosts with some of the
outage statistics contained, then these were missing. This problem did not arise when
you did an PDF export or simply added an availability table to an existing report via
the context menu.
---
.werks/3614 | 13 +++++++++++++
ChangeLog | 1 +
web/htdocs/availability.py | 18 +++++++++++++++---
web/plugins/views/availability.py | 6 ------
4 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/.werks/3614 b/.werks/3614
new file mode 100644
index 0000000..db0c4e9
--- /dev/null
+++ b/.werks/3614
@@ -0,0 +1,13 @@
+Title: Outage statistics for hosts now also work in PDF reports
+Level: 1
+Component: reporting
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1464348499
+
+If you created a PDF report containing an availability table of hosts with some of the
+outage statistics contained, then these were missing. This problem did not arise when
+you did an PDF export or simply added an availability table to an existing report via
+the context menu.
diff --git a/ChangeLog b/ChangeLog
index 7092265..88449ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -427,6 +427,7 @@
* 3332 FIX: Avoid falling back to annotation edit form when reloading page directly
after editing
* 3393 FIX: Availability annotations: also show annotations for hosts when showing
services
* 3415 FIX: Availability option "Visual levels for the availability" not
longer enables itself...
+ * 3614 FIX: Outage statistics for hosts now also work in PDF reports...
Event Console:
* 2999 The contact name is now included in Event Console notifications...
diff --git a/web/htdocs/availability.py b/web/htdocs/availability.py
index cb3a0d3..9c1dbd8 100644
--- a/web/htdocs/availability.py
+++ b/web/htdocs/availability.py
@@ -531,6 +531,18 @@ def get_default_avoptions():
},
}
+def get_outage_statistic_options(avoptions):
+ # Outage options are stored with keys matching service states (like "ok"
and "crit").
+ # For hosts we use the same checkbox but mean "up" and "down". We
simply add these states
+ # to the list of selected states.
+ aggrs, states = avoptions.get("outage_statistics", ([], []))
+ fixed_states = states[:]
+ for os, oh in [ ("ok","up"), ("crit","down"),
("unknown", "unreach") ]:
+ if os in fixed_states:
+ fixed_states.append(oh)
+ return aggrs, fixed_states
+
+
#.
# .--Computation---------------------------------------------------------.
# | ____ _ _ _ |
@@ -633,7 +645,7 @@ def compute_availability(what, av_rawdata, avoptions):
# 2.2.2.2.3 "crit"
# 2.2.2.2.4 "unknown"
availability_table = []
- os_aggrs, os_states = avoptions.get("outage_statistics", ([],[]))
+ os_aggrs, os_states = get_outage_statistic_options(avoptions)
need_statistics = os_aggrs and os_states
grouping = avoptions["grouping"]
timeline_rows = [] # Need this as a global variable if just one service is affected
@@ -1091,7 +1103,7 @@ def layout_availability_table(what, group_title, availability_table,
avoptions):
# Headers for availability cells
av_table["cell_titles"] = []
- os_aggrs, os_states = avoptions.get("outage_statistics", ([],[]))
+ os_aggrs, os_states = get_outage_statistic_options(avoptions)
for sid, css, sname, help in availability_columns[what]:
if not cell_active(sid, avoptions):
continue
@@ -1183,7 +1195,7 @@ def layout_availability_table(what, group_title, availability_table,
avoptions):
# Statistics?
x_cnt, x_min, x_max = entry["statistics"].get(sid, (None, None,
None))
- os_aggrs, os_states = avoptions.get("outage_statistics", ([],[]))
+ os_aggrs, os_states = get_outage_statistic_options(avoptions)
if sid in os_states:
for aggr in os_aggrs:
if x_cnt != None:
diff --git a/web/plugins/views/availability.py b/web/plugins/views/availability.py
index b2b78de..34961d0 100644
--- a/web/plugins/views/availability.py
+++ b/web/plugins/views/availability.py
@@ -106,12 +106,6 @@ def render_availability_options(what):
if html.form_submitted():
config.save_user_file("avoptions", avoptions)
- # Convert outage-options from service to host
- states = avoptions["outage_statistics"][1]
- for os, oh in [ ("ok","up"), ("crit","down"),
("unknown", "unreach") ]:
- if os in states:
- states.append(oh)
-
return avoptions