Module: check_mk
Branch: master
Commit: babfd065300b0a242f6e779a33403b77d835724c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=babfd065300b0a…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Mar 17 17:33:06 2014 +0100
BI aggregates now acknowledgement information
Check_MK BI now also aggregates the information wether problems that make the aggregate
non-OK are acknowledged. Please refer to the updated <a
href="checkmk_bi.html">documentation
about BI</a> for details.
---
.werks/715 | 11 +++++++++++
ChangeLog | 1 +
web/htdocs/bi.py | 24 ++++++++++++++++++++++--
web/plugins/views/bi.py | 2 ++
4 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/.werks/715 b/.werks/715
new file mode 100644
index 0000000..e15fb26
--- /dev/null
+++ b/.werks/715
@@ -0,0 +1,11 @@
+Title: BI aggregates now acknowledgement information
+Level: 2
+Component: bi
+Version: 1.2.5i1
+Date: 1395073928
+Class: feature
+
+Check_MK BI now also aggregates the information wether problems that make the aggregate
+non-OK are acknowledged. Please refer to the updated <a
href="checkmk_bi.html">documentation
+about BI</a> for details.
+
diff --git a/ChangeLog b/ChangeLog
index b962247..0037d89 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -334,6 +334,7 @@
BI:
* 0721 Use hard states in BI aggregates...
* 0714 BI aggregations now also honor scheduled downtimes...
+ * 0715 BI aggregates now acknowledgement information...
* 0669 FIX: Fixed regex matching in BI when using character groups [...]...
Reporting & Availability:
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index 8fda93a..aac8a89 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -1107,13 +1107,22 @@ def execute_rule_node(node, status_info, use_hard_states):
node_states = []
assumed_states = []
downtime_states = []
+ ack_states = [] # Needed for computing the acknowledgement of non-OK nodes
one_assumption = False
for n in node["nodes"]:
result = execute_node(n, status_info, use_hard_states) # state, assumed_state,
node [, subtrees]
subtrees.append(result)
- # Assume items in downtime as CRIT
+
+ # Assume items in downtime as CRIT when computing downtime state
downtime_states.append(({"state": result[0]["in_downtime"]
and 2 or 0, "output" : ""}, result[2]))
+ # Assume non-OK nodes that are acked as OK
+ if result[0]["acknowledged"]:
+ acked_state = 0
+ else:
+ acked_state = result[0]["state"]
+ ack_states.append(({"state": acked_state, "output" :
""}, result[2]))
+
node_states.append((result[0], result[2]))
if result[1] != None:
assumed_states.append((result[1], result[2]))
@@ -1125,9 +1134,16 @@ def execute_rule_node(node, status_info, use_hard_states):
downtime_state = func(*([downtime_states] + funcargs))
state = func(*([node_states] + funcargs))
state["in_downtime"] = downtime_state["state"] >= 2
+ if state["state"] > 0: # Non-OK-State -> compute acknowledgedment
+ ack_state = func(*([ack_states] + funcargs))
+ state["acknowledged"] = ack_state["state"] == 0 # would be OK
if acked problems would be OK
+ else:
+ state["acknowledged"] = False
+
if one_assumption:
assumed_state = func(*([assumed_states] + funcargs))
assumed_state["in_downtime"] = state["in_downtime"]
+ assumed_state["acknowledged"] = state["acknowledged"]
else:
assumed_state = None
return (state, assumed_state, node, subtrees)
@@ -1529,7 +1545,7 @@ def render_tree_foldable(row, boxes, omit_root, expansion_level,
only_problems,
return "aggrtree" + (boxes and "_box" or ""), htmlcode
def aggr_render_node(tree, title, mousecode, show_host):
-
+
# Check if we have an assumed state: comparing assumed state (tree[1]) with state
(tree[0])
if tree[1] and tree[0] != tree[1]:
addclass = " " + _("assumed")
@@ -1542,6 +1558,10 @@ def aggr_render_node(tree, title, mousecode, show_host):
title = ('<img class="icon bi"
src="images/icon_downtime.png" title="%s">' % \
_("This element is currently in a scheduled downtime")) + title
+ if tree[0]["acknowledged"]:
+ title = ('<img class="icon bi"
src="images/icon_ack.png" title="%s">' % \
+ _("This problem has been acknowledged")) + title
+
h = '<span class="content state state%d%s">%s</span>\n'
\
% (effective_state["state"], addclass,
render_bi_state(effective_state["state"]))
if mousecode:
diff --git a/web/plugins/views/bi.py b/web/plugins/views/bi.py
index 9a89b2c..a335f1c 100644
--- a/web/plugins/views/bi.py
+++ b/web/plugins/views/bi.py
@@ -80,6 +80,8 @@ def paint_bi_icons(row):
html.icon_button(avail_url, _("Analyse availability of this aggregation"),
"availability")
if row["aggr_effective_state"]["in_downtime"]:
html.icon(_("This aggregation is currently in a scheduled downtime"),
"downtime")
+ if row["aggr_effective_state"]["acknowledged"]:
+ html.icon(_("The critical problems that make this aggregation non-OK have been
acknowledged"), "ack")
code = html.drain()
html.unplug()
return "buttons", code