Module: check_mk
Branch: master
Commit: c77291c541c546336f7374424e695f6898a2cf45
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c77291c541c546…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Fri Jul 17 14:04:34 2015 +0200
#2451 wut_webtherm.humidity, wut_webtherm.pressure: Two new checks for humidity and air
pressure sensors for WuT devices
---
.werks/2451 | 9 ++++++
ChangeLog | 1 +
checkman/wut_webtherm.humidity | 18 ++++++++++++
checkman/wut_webtherm.pressure | 14 +++++++++
checks/wut_webtherm | 53 +++++++++++++++++-----------------
web/plugins/wato/check_parameters.py | 5 ++--
6 files changed, 71 insertions(+), 29 deletions(-)
diff --git a/.werks/2451 b/.werks/2451
new file mode 100644
index 0000000..79a5025
--- /dev/null
+++ b/.werks/2451
@@ -0,0 +1,9 @@
+Title: wut_webtherm.humidity, wut_webtherm.pressure: Two new checks for humidity and air
pressure sensors for WuT devices
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i3
+Date: 1437134633
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index b256165..1042139 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,7 @@
NOTE: Please refer to the migration notes!
* 1273 bvip_cams, bvip_fans, bvip_info, bvip_link, bvip_poe, bvip_temp, bvip_util,
bvip_video_alerts: New Checks for Bosch Video over IP Cameras
* 2405 New checks for UCS bladecenter: ucs_bladecenter_topsystem,
ucs_bladecenter_faulinst...
+ * 2451 wut_webtherm.humidity, wut_webtherm.pressure: Two new checks for humidity and
air pressure sensors for WuT devices
* 2315 FIX: windows agent: BOM replacement, fixed incorrect byte offset...
* 2316 FIX: windows agent: fix garbled output of cached agent plugins...
* 2358 FIX: check_mk_agent.solaris: more correct computation of zfs used space...
diff --git a/checkman/wut_webtherm.humidity b/checkman/wut_webtherm.humidity
new file mode 100644
index 0000000..08bee2d
--- /dev/null
+++ b/checkman/wut_webtherm.humidity
@@ -0,0 +1,18 @@
+title: WuT Web-Thermograph: Humidity
+agents: snmp
+catalog: hw/environment/wut
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the humidity of sensors attached
+ to a WuT (Wiesemann & Theis) Web-Thermograph.
+
+item:
+ The item is the number of the sensor as string - usually {"2"}.
+
+perfdata:
+ One variable: the current humidity.
+
+inventory:
+ All available humidity sensors are automatically inventorized.
+
diff --git a/checkman/wut_webtherm.pressure b/checkman/wut_webtherm.pressure
new file mode 100644
index 0000000..2366d9d
--- /dev/null
+++ b/checkman/wut_webtherm.pressure
@@ -0,0 +1,14 @@
+title: WuT Web-Thermograph: Air Pressure
+agents: snmp
+catalog: hw/environment/wut
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the air pressor of sensors attached
+ to a WuT (Wiesemann & Theis) Web-Thermograph.
+
+item:
+ The item is the number of the sensor as string - usually {"3"}.
+
+inventory:
+ All available humidity sensors are automatically inventorized.
diff --git a/checks/wut_webtherm b/checks/wut_webtherm
index add64ee..fd142c5 100644
--- a/checks/wut_webtherm
+++ b/checks/wut_webtherm
@@ -7,7 +7,7 @@
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
-# | Copyright Mathias Kettner 2014 mk(a)mathias-kettner.de |
+# | Copyright Mathias Kettner 2015 mk(a)mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
@@ -36,7 +36,6 @@ def detect_webtherm(oid):
".1.3.6.1.4.1.5040.1.2.16",
".1.3.6.1.4.1.5040.1.2.18" ]
-#.
# .--Air Pressure--------------------------------------------------------.
# | _ _ ____ |
# | / \ (_)_ __ | _ \ _ __ ___ ___ ___ _ _ _ __ ___ |
@@ -46,21 +45,24 @@ def detect_webtherm(oid):
# | |
# '----------------------------------------------------------------------'
-#def inventory_wut_webtherm_pressure(info):
-# for index, reading in info:
-# if index.split(".")[1] == "3":
-# yield "3", None
-#
-#
-#def check_wut_webtherm_pressure(item, params, info):
-# return 3, "Not implemented yet"
-#
-#
-#check_info["wut_webtherm.pressure"] = {
-# "inventory_function" : inventory_wut_webtherm_pressure,
-# "check_function" : check_wut_webtherm_pressure,
-# "service_description" : "Pressure %s",
-#}
+def inventory_wut_webtherm_pressure(info):
+ for index, reading in info:
+ if index.split(".")[1] == "3":
+ return [ ("3", None) ]
+
+
+def check_wut_webtherm_pressure(item, _no_params, info):
+ for index, reading in info:
+ if index.split(".")[1] == item:
+ pressure = float(reading.replace(",",".")) # This value
is in hPa
+ return 0, "%.2f hPa" % pressure
+
+
+check_info["wut_webtherm.pressure"] = {
+ "inventory_function" : inventory_wut_webtherm_pressure,
+ "check_function" : check_wut_webtherm_pressure,
+ "service_description" : "Pressure %s",
+}
#.
# .--Humidity------------------------------------------------------------.
@@ -77,11 +79,13 @@ wut_webtherm_humidity_defaultlevels = (35, 40, 60, 65)
def inventory_wut_webtherm_humidity(info):
for index, reading in info:
if index.split(".")[1] == "2":
- yield "2", None
+ return [ ("2", "wut_webtherm_humidity_defaultlevels") ]
def check_wut_webtherm_humidity(item, params, info):
- humidity = float(line[1].replace(",","."))
+ for index, reading in info:
+ if index.split(".")[1] == item:
+ humidity = float(reading.replace(",","."))
return check_humidity(humidity, params)
@@ -110,14 +114,9 @@ factory_settings["wut_webtherm_defaultlevels"] = {
def inventory_wut_webtherm(info):
# line[0] is 1.1, 2.1, 3.1, 6.1, 8.1, 16.1 or 18.1 depending on MIB variant. We chop
# of the first part in order to get independent of that.
- for line in info:
- if len(line) == 2:
- temp = float(line[1].replace(",", "."))
- # If greater then 75 it can't be a temperature sensor.
- # Maybe humidity
- if temp > 75:
- continue
- yield line[0].split(".")[1], {}
+ for index, reading in info:
+ if index.split(".")[1] == "1":
+ return [ ("1", {}) ]
def check_wut_webtherm(item, params, info):
for line in info:
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 50b501d..17abf91 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -4274,8 +4274,9 @@ register_check_parameters(
Integer(title = _("Critical at or above"), unit="%" ),
]),
TextAscii(
- title = _("Sensor names"),
- allow_empty = False),
+ title = _("Sensor name")
+ help = _("The identifier of the sensor.")
+ ),
match_type = "first",
)