Module: check_mk
Branch: master
Commit: c11a9c8455f62e016e50fba21c3dec6288907490
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c11a9c8455f62e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Mar 7 09:05:14 2014 +0100
BI: Added option ignore stataes to worst/best aggregation functions (only internal atm)
---
web/htdocs/bi.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index 0e2063c..1ac5558 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -1202,8 +1202,8 @@ def x_best_state(l, x):
return ll[n-1][1]
-def aggr_nth_state(nodelist, n, worst_state):
- states = [ i[0]["state"] for i in nodelist ]
+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)
# limit to worst state
@@ -1212,11 +1212,11 @@ def aggr_nth_state(nodelist, n, worst_state):
return { "state" : state, "output" : "" }
-def aggr_worst(nodes, n = 1, worst_state = CRIT):
- return aggr_nth_state(nodes, -int(n), int(worst_state))
+def aggr_worst(nodes, n = 1, worst_state = CRIT, ignore_states = None):
+ return aggr_nth_state(nodes, -int(n), int(worst_state), ignore_states)
-def aggr_best(nodes, n = 1, worst_state = CRIT):
- return aggr_nth_state(nodes, int(n), int(worst_state))
+def aggr_best(nodes, n = 1, worst_state = CRIT, ignore_states = None):
+ return aggr_nth_state(nodes, int(n), int(worst_state), ignore_states)
config.aggregation_functions["worst"] = aggr_worst
config.aggregation_functions["best"] = aggr_best