Module: check_mk
Branch: master
Commit: 9543fcfffbbc7da656aa7fcecc61a372aaaf86fa
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9543fcfffbbc7d…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Wed Mar 4 18:17:11 2015 +0100
#1894 hwg_humidity: New check to monitor humidity sensors attached to HWg-STE
Accessory humidity sensors attached to HWg-STE ethernet thermometers are now
inventorized and checked.
---
.werks/1894 | 10 +++++
ChangeLog | 1 +
checkman/hwg_humidity | 23 ++++++++++++
checks/humidity.include | 60 +++++++++++++++++++++++++++++
checks/hwg_humidity | 79 +++++++++++++++++++++++++++++++++++++++
web/plugins/metrics/check_mk.py | 1 +
6 files changed, 174 insertions(+)
diff --git a/.werks/1894 b/.werks/1894
new file mode 100644
index 0000000..0ca3ef4
--- /dev/null
+++ b/.werks/1894
@@ -0,0 +1,10 @@
+Title: hwg_humidity: New check to monitor humidity sensors attached to HWg-STE
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1425489361
+Class: feature
+
+Accessory humidity sensors attached to HWg-STE ethernet thermometers are now
+inventorized and checked.
diff --git a/ChangeLog b/ChangeLog
index dcf70e1..6d29eb9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -105,6 +105,7 @@
* 2052 winperf_if: Now able to automatically group teamed interfaces and more...
NOTE: Please refer to the migration notes!
* 2053 New windows plugin: windows_if.ps1, renders wmic_if.ps1 obsolete...
+ * 1894 hwg_humidity: New check to monitor humidity sensors attached to HWg-STE...
* 1457 FIX: logins: new check renamed from "users" check...
NOTE: Please refer to the migration notes!
* 1762 FIX: lnx_thermal: Now ignoring trip points with level 0...
diff --git a/checkman/hwg_humidity b/checkman/hwg_humidity
new file mode 100644
index 0000000..279c1d1
--- /dev/null
+++ b/checkman/hwg_humidity
@@ -0,0 +1,23 @@
+title: HWg-STE Ethernet Thermometer: Humidity
+agents: snmp
+catalog: hw/environment/hwg
+license: GPL
+distribution: check_mk
+description:
+ This check monitors humidity via an accessory humidity sensor attached to
+ the HWg-STE Ethernet thermometer.
+
+item:
+ The name of the sensor "a string".
+
+perfdata:
+ One variable: the current humidity.
+
+inventory:
+ All available humidity sensors are automatically inventorized.
+
+[parameters]
+critical low (int): lower border for triggering critical level
+warning low (int): lower border for warning level
+warning high (int): upper border for triggering warning level
+critical high (int): upper border for critical level
diff --git a/checks/humidity.include b/checks/humidity.include
new file mode 100644
index 0000000..6ab52ff
--- /dev/null
+++ b/checks/humidity.include
@@ -0,0 +1,60 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2015 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+def check_humidity(humidity, params):
+
+ if params:
+ crit_lower, warn_lower, warn_upper, crit_upper = params
+ else:
+ crit_lower, warn_lower, warn_upper, crit_upper = -1, -1, 101, 101
+
+ perfdata = [ ("humidity", humidity, warn_upper, crit_upper, 0, 100) ]
+ infotext = get_percent_human_readable(humidity)
+ levelstext = ""
+ levelstext_lower = " (warn/crit at or below %s/%s)" % (
+ get_percent_human_readable(warn_lower),
+ get_percent_human_readable(crit_lower))
+ levelstext_upper = " (warn/crit at or above %s/%s)" % (
+ get_percent_human_readable(warn_upper),
+ get_percent_human_readable(crit_upper))
+
+ if humidity <= crit_lower:
+ status = 2
+ levelstext += levelstext_lower
+ elif humidity >= crit_upper:
+ status = 2
+ levelstext += levelstext_upper
+ elif humidity <= warn_lower:
+ status = 1
+ levelstext += levelstext_lower
+ elif humidity >= warn_upper:
+ status = 1
+ levelstext += levelstext_upper
+ else:
+ status = 0
+
+ infotext += levelstext
+ return status, infotext, perfdata
diff --git a/checks/hwg_humidity b/checks/hwg_humidity
new file mode 100644
index 0000000..7307adc
--- /dev/null
+++ b/checks/hwg_humidity
@@ -0,0 +1,79 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2015 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+
+hwg_humidity_defaultlevels = (0, 0, 60, 70)
+
+def inventory_hwg_humidity(info):
+ return [ (line[0], "hwg_humidity_defaultlevels")
+ for line in info
+ if int(line[2]) != 0 and line[4] in ["4"] ]
+
+
+def check_hwg_humidity(item, params, info):
+# status_text = {
+# "0" : "Invalid",
+# "1" : "Normal",
+# "2" : "Out Of Range Low",
+# "3" : "Out Of Range High",
+# "4" : "Alarm Low",
+# "5" : "Alarm High",
+# }
+
+ # Nomenclature in this check: sensorstatus is what the device sends, status is what
the check returns.
+ for index, descr, sensorstatus, current, unit in info:
+ if index == item:
+ if unit != "4":
+ return
+
+ humidity = float(current)
+ status, infotext, perfdata = check_humidity(humidity, params)
+ if descr:
+ infotext += " (%s)" % descr
+ return status, infotext, perfdata
+
+
+
+check_info['hwg_humidity'] = {
+ "check_function" : check_hwg_humidity,
+ "inventory_function" : inventory_hwg_humidity,
+ "service_description" : "Humidity %s",
+ "has_perfdata" : True,
+ "snmp_info" : (".1.3.6.1.4.1.21796.4.1.3", [# sensors index
(1-2)
+ "1.1",
+ # sensor name string
+ "1.2",
+ # unit state: 0=Invalid, 1=Normal, 2=OutOfRangeLo, 3=OutOfRangeHi, 4=AlarmLo,
5=AlarmHi
+ "1.3",
+ # current value string
+ "1.4",
+ # sensor unit integer 0=unknown, 1=°C, 2=°F, 3=°K, 4=%
+ "1.7",
+ ]),
+ "snmp_scan_function" : lambda oid: "hwg" in
oid(".1.3.6.1.2.1.1.1.0").lower(),
+ "group" : "humidity",
+}
+
diff --git a/web/plugins/metrics/check_mk.py b/web/plugins/metrics/check_mk.py
index b292830..ca7c735 100644
--- a/web/plugins/metrics/check_mk.py
+++ b/web/plugins/metrics/check_mk.py
@@ -491,6 +491,7 @@ check_metrics["check_mk-adva_fsp_current"]
= {}
check_metrics["check_mk-akcp_exp_humidity"] = {}
check_metrics["check_mk-apc_humidity"] = {}
+check_metrics["check_mk-hwg_humidity"] = {}
check_metrics["check_mk-apache_status"] = {
"ReqPerSec" : { "name" : "requests_per_second" },
"BusyWorkers" : { "name" : "busy_workers" }}