Module: check_mk
Branch: master
Commit: 57958a64dac4cb197c8492e18acfe9229e44887f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=57958a64dac4cb…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Dec 6 10:36:57 2016 +0100
improved filter
---
web/plugins/visuals/filters.py | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/web/plugins/visuals/filters.py b/web/plugins/visuals/filters.py
index 453f135..71ca836 100644
--- a/web/plugins/visuals/filters.py
+++ b/web/plugins/visuals/filters.py
@@ -1244,13 +1244,23 @@ class FilterECServiceLevelRange(Filter):
upper_bound = html.var(self.upper_bound_varname)
if lower_bound and upper_bound:
+ match_func = lambda val: int(lower_bound) <= val <= int(upper_bound)
+ elif lower_bound and not upper_bound:
+ match_func = lambda val: int(lower_bound) <= val
+ elif not lower_bound and upper_bound:
+ match_func = lambda val: val <= int(upper_bound)
+ else:
+ match_func = None
+
+ if match_func is not None:
filterline = "Filter: %s_custom_variable_names >= EC_SL\n" %
self.info
filterline_values = []
for value, readable in config.mkeventd_service_levels:
- if value >= int(lower_bound) and value <= int(upper_bound):
+ if match_func(value):
filterline_values.append( "Filter: %s_custom_variable_values
>= %s" % \
(self.info, lqencode(str(value))) )
+
filterline += "%s\n" % "\n".join( filterline_values )
len_filterline_values = len(filterline_values)