Module: check_mk
Branch: master
Commit: 2dc97896409d4530fb9f415219210f1324a4c33a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2dc97896409d45…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Wed Jan 14 14:45:07 2015 +0100
hwg_temp: Moved handling of device unit to temperature.include
---
checks/hwg_temp | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/checks/hwg_temp b/checks/hwg_temp
index c8ffe66..d84931f 100644
--- a/checks/hwg_temp
+++ b/checks/hwg_temp
@@ -43,28 +43,20 @@ def check_hwg_temp(item, params, info):
"5" : "Alarm High",
}
- unit_text = {
- "0" : "unknown",
- "1" : "°C",
- "2" : "°F",
- "3" : "°K",
- "4" : "%",
- }
-
# Nomenclature in this check: sensorstatus is what the device sends, state is what
the check returns.
for index, descr, sensorstatus, current, unit in info:
if index == item:
tempval = float(current)
if unit == "2":
- temp = fahrenheit_to_celsius(tempval)
+ dev_unit = "f"
elif unit == "3":
- temp = tempval - 273.15
+ dev_unit = "k"
elif unit == "4":
return
else:
- temp = tempval
+ dev_unit = "c"
- state, infotext, perfdata = check_temperature(temp, params)
+ state, infotext, perfdata = check_temperature(tempval, params, dev_unit)
if descr:
infotext += " (%s)" % descr
yield state, infotext, perfdata