Module: check_mk
Branch: master
Commit: b5c9d57a881812d974afb182adf864213a72d162
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b5c9d57a881812…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jun 20 10:14:37 2014 +0200
BI: Fixed problem with ignoring states in worst aggregation function
---
web/htdocs/bi.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index 9034ce4..82cf286 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -1271,7 +1271,12 @@ def x_best_state(l, x):
def aggr_nth_state(nodelist, n, worst_state, ignore_states = None):
states = [ i[0]["state"] for i in nodelist if not ignore_states or
i[0]["state"] not in ignore_states ]
- state = x_best_state(states, n)
+ # In case of the ignored states it might happen that the states list is empty. Use
the
+ # OK state in this case.
+ if not states:
+ state = OK
+ else:
+ state = x_best_state(states, n)
# limit to worst state
if state_weight(state) > state_weight(worst_state):