Module: check_mk
Branch: master
Commit: 62149a607a15ebfb045fec1db392af6cbe353542
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=62149a607a15eb…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Mon May 30 10:56:16 2016 +0200
tinkerforge: some polishing
---
checks/tinkerforge | 25 +++++++++++++------------
web/plugins/wato/datasource_programs.py | 3 +++
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/checks/tinkerforge b/checks/tinkerforge
index 4d3dc70..18fcbcf 100644
--- a/checks/tinkerforge
+++ b/checks/tinkerforge
@@ -32,10 +32,7 @@
# based on customers investigation
-factory_settings['tinkerforge_humidity_default_levels'] = {
- 'upper': (50, 55),
- 'lower': (40, 35)
-}
+tinkerforge_humidity_default_levels = (35, 40, 50, 55)
def parse_tinkerforge(info):
@@ -87,7 +84,11 @@ def parse_tinkerforge(info):
def inventory_tinkerforge(brick_type, parsed):
for path in parsed.get(brick_type, {}).keys():
- yield path, {}
+ if brick_type == "humidity":
+ # stupid wato rule with its stupid tuple-based parameters is stupid
+ yield path, "tinkerforge_humidity_default_levels"
+ else:
+ yield path, None
def check_tinkerforge_master(item, params, parsed):
@@ -125,18 +126,19 @@ def check_tinkerforge_humidity(item, params, parsed):
return max([abs(x[0] - x[1][0]) for x in enumerate(sorted_by_val)])
if 'humidity' in parsed and item in parsed['humidity']:
+ crit_lower, warn_lower, warn_upper, crit_upper = params
+
reading = float(parsed['humidity'][item][0]) / 10.0
- status = expect_order(params['lower'][1], params['lower'][0],
+ status = expect_order(crit_lower, warn_lower,
reading,
- params['upper'][0], params['upper'][1])
+ warn_upper, crit_upper)
if status != 0:
- level_msg = " (warn/crit below %.1f/%.1f or above %.1f/%.1f)" % \
- (params['lower'][0], params['lower'][1],
- params['upper'][0], params['upper'][1])
+ level_msg = " (warn/crit at or below %.1f/%.1f or at or above
%.1f/%.1f)" % \
+ (warn_lower, crit_lower, warn_upper, crit_upper)
else:
level_msg = ""
return (status, "%.1f %%RH%s" % (reading, level_msg),
- [('humidity', reading, params['upper'][0],
params['upper'][1])])
+ [('humidity', reading, warn_upper, crit_upper)])
def check_tinkerforge_motion(item, params, parsed):
@@ -199,7 +201,6 @@ check_info['tinkerforge.humidity'] = {
'has_perfdata' : True,
'group' : 'humidity',
'service_description' : "Humidity %s",
- 'default_levels_variable' : 'tinkerforge_humidity_default_levels'
}
diff --git a/web/plugins/wato/datasource_programs.py
b/web/plugins/wato/datasource_programs.py
index bcaef33..206af65 100644
--- a/web/plugins/wato/datasource_programs.py
+++ b/web/plugins/wato/datasource_programs.py
@@ -914,6 +914,9 @@ register_rule(group,
( "segment_display_uid",
TextAscii(
title = _("7-segment display uid"),
+ help = _("This is the uid of the sensor you want to display in the
7-segment display, "
+ "not the uid of the display itself. There is currently no
support for "
+ "controling multiple displays.")
)
),
( "segment_display_brightness",