Module: check_mk
Branch: master
Commit: 967ca8aa02ef6ba3c6eaf535451a4d7f503f16a0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=967ca8aa02ef6b…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Dec 10 09:49:35 2013 +0100
apc_humidity: New Check for humidity levels on APC Devices
---
.werks/105 | 8 +++++++
ChangeLog | 1 +
checkman/apc_humidity | 36 +++++++++++++++++++++++++++++
checks/apc_humidity | 60 +++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 105 insertions(+)
diff --git a/.werks/105 b/.werks/105
new file mode 100644
index 0000000..bd9cb5c
--- /dev/null
+++ b/.werks/105
@@ -0,0 +1,8 @@
+Title: apc_humidity: New Check for humidity levels on APC Devices
+Level: 1
+Component: checks
+Version: 1.2.3i8
+Date: 1386665341
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 8cae72b..7940374 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
Checks & Agents:
* 0306 esx_vsphere_counters: added missing ramdisk levels sfcbtickets
* 0073 moxa_iologik_register: new check to monitor moxa e2000 series registers
+ * 0105 apc_humidity: New Check for humidity levels on APC Devices
* 0103 FIX: services: Fixed bug with service inventory defined in main.mk...
* 0299 FIX: borcade_mlx_fan: Prettified output, handling "other" state now
* 0300 FIX: cisco_fru_power: Trying not to inventorize not plugged in FRUs...
diff --git a/checkman/apc_humidity b/checkman/apc_humidity
new file mode 100644
index 0000000..537da4b
--- /dev/null
+++ b/checkman/apc_humidity
@@ -0,0 +1,36 @@
+title: APC Humidity
+agents: snmp
+catalog: hw/environment
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the humidity of sensors attached
+ to several APC devices.
+
+item:
+ The item is the sensor description of the sensor as string.
+
+perfdata:
+ the current humidity in percent, lower crit, lower warn, upper warn, upper crit
+
+inventory:
+ All available humidity sensors are automatically inventorized.
+
+examples:
+ # set default levels for all apc humidity sensors
+ apc_humidity_default_levels = (35, 40, 60, 65)
+
+ # to Overwrite the default levels levels for a sensor
+ check_parameters += [
+ ( ( lower crit, lower warn, upper warn, upper crit ), ['hostname'],
['Humidity Senosr Name'] ),
+ ]
+
+[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
+
+[configuration]
+apc_humidity (int, int, int, int): default levels for lower critical lower warning
+ and upper warning, upper critical. Preset to ( 35, 40, 60, 65 ).
diff --git a/checks/apc_humidity b/checks/apc_humidity
new file mode 100644
index 0000000..0b9b4b3
--- /dev/null
+++ b/checks/apc_humidity
@@ -0,0 +1,60 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 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.
+
+
+apc_humidity_default_levels = (35, 40, 60, 65)
+
+
+def inventory_apc_humidity(info):
+ return [(line[0], "apc_humidity_default_levels") for line in info]
+
+def check_apc_humidity(item, params, info):
+ for line in info:
+ if line[0] == item:
+ humidity = saveint(line[1])
+ warnlow, critlow, warnhigh, crithigh = params
+ infotext = "%s%%" % humidity + " (warn/crit below %.1f/%.1f or
above %.1f/%.1f %%" % \
+ (critlow, warnlow, warnhigh, crithigh) + ")"
+ perfdata = [ ( "humidity", humidity, critlow, warnlow, warnhigh,
crithigh ) ]
+ if humidity <= critlow or humidity >= crithigh:
+ return (2, "Humidity is: " + infotext, perfdata )
+ elif humidity <= warnlow or humidity >= warnhigh:
+ return (1, "Humidity is: " + infotext, perfdata )
+ else:
+ return (0, "Humidity is: " + infotext, perfdata )
+
+ return (3, "sensor not found in SNMP data")
+
+
+check_info["apc_humidity"] = {
+ 'check_function': check_apc_humidity,
+ 'inventory_function': inventory_apc_humidity,
+ 'service_description': 'Humidity %s',
+ 'has_perfdata': True,
+ 'snmp_info': ('.1.3.6.1.4.1.318.1.1.10.4.2.3.1',
['3', '6']),
+ 'snmp_scan_function': lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.318.1.3"),
+ 'group': 'humidity',
+}