Module: check_mk
Branch: master
Commit: a272404b1a19194b97db24710dc14ff892aa4d75
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a272404b1a1919…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Oct 7 11:54:57 2015 +0200
preliminary version of check etherbox2_temp
---
checks/etherbox2_temp | 95 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 95 insertions(+)
diff --git a/checks/etherbox2_temp b/checks/etherbox2_temp
new file mode 100644
index 0000000..5d0983d
--- /dev/null
+++ b/checks/etherbox2_temp
@@ -0,0 +1,95 @@
+#!/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.
+
+# .1.3.6.1.4.1.14848.2.1.7.1.2.1 -0.0008 Volt -->
BETTER-NETWORKS-ETHERNETBOX-MIB::ethernetboxObjects.7.1.2.1
+# .1.3.6.1.4.1.14848.2.1.7.1.2.2 -0.0008 Volt -->
BETTER-NETWORKS-ETHERNETBOX-MIB::ethernetboxObjects.7.1.2.2
+# .1.3.6.1.4.1.14848.2.1.7.1.2.3 5.0015 Volt -->
BETTER-NETWORKS-ETHERNETBOX-MIB::ethernetboxObjects.7.1.2.3
+# .1.3.6.1.4.1.14848.2.1.7.1.2.4 2.0031 Volt -->
BETTER-NETWORKS-ETHERNETBOX-MIB::ethernetboxObjects.7.1.2.4
+# .1.3.6.1.4.1.14848.2.1.7.1.2.5 -0.0005 Volt -->
BETTER-NETWORKS-ETHERNETBOX-MIB::ethernetboxObjects.7.1.2.5
+# .1.3.6.1.4.1.14848.2.1.7.1.2.6 -0.0004 Volt -->
BETTER-NETWORKS-ETHERNETBOX-MIB::ethernetboxObjects.7.1.2.6
+# .1.3.6.1.4.1.14848.2.1.7.1.2.7 5.0002 Volt -->
BETTER-NETWORKS-ETHERNETBOX-MIB::ethernetboxObjects.7.1.2.7
+# .1.3.6.1.4.1.14848.2.1.7.1.2.8 2.0010 Volt -->
BETTER-NETWORKS-ETHERNETBOX-MIB::ethernetboxObjects.7.1.2.8
+
+# .1.3.6.1.4.1.14848.2.1.9.1.2.1 -2472 -->
BETTER-NETWORKS-ETHERNETBOX-MIB::ethernetboxObjects.9.1.2.1
+# .1.3.6.1.4.1.14848.2.1.9.1.2.2 252 -->
BETTER-NETWORKS-ETHERNETBOX-MIB::ethernetboxObjects.9.1.2.2
+# .1.3.6.1.4.1.14848.2.1.9.1.2.3 0 -->
BETTER-NETWORKS-ETHERNETBOX-MIB::ethernetboxObjects.9.1.2.3
+# .1.3.6.1.4.1.14848.2.1.9.1.2.4 248 -->
BETTER-NETWORKS-ETHERNETBOX-MIB::ethernetboxObjects.9.1.2.4
+
+
+# suggested by customer
+factory_settings['etherbox_temp_default_levels'] = {
+ 'levels' : (25, 30),
+ 'levels_lower' : (10, 15),
+}
+
+
+def parse_etherbox_temp(info):
+ # We have to use xxx.7.1.2.a to know if a temperature sensor
+ # is connected:
+ # - if oid(xxx.7.1.2.{a}) == 5.fff and oid(xxx.7.1.2.{a+1}) == 2.fff
+ # then a temperature sensor is connected to oid(xxx.9.1.2.{(a+1)/2})
+ # (a = 1, 3, 5, ...)
+ # - otherwise there's no sensor connected.
+ # Furthermore we cannot only use xxx.9.1.2.{a} < 0 (or something like that)
+ # because the temperature can drop below 0.
+ parsed = {}
+ sensor_indicators, sensors = info
+ for sensor_index in range(0, len(sensors)):
+ indicator_index_1, indicator_index_2 = (lambda x: (2*x, 2*x+1))(sensor_index)
+ if float(sensor_indicators[indicator_index_1][0].split(" ")[0]) > 4
and \
+ float(sensor_indicators[indicator_index_2][0].split(" ")[0]) >
1:
+ parsed["Sensor %s" % sensors[sensor_index][0]] =
float(sensors[sensor_index][1]) / 10
+
+ return parsed
+
+
+def inventory_etherbox_temp(parsed):
+ return [ (sensor, {}) for sensor in parsed ]
+
+
+def check_etherbox_temp(item, params, parsed):
+ if item in parsed:
+ return check_temperature(parsed[item], params)
+
+
+check_info['etherbox_temp'] = {
+ 'parse_function' : parse_etherbox_temp,
+ 'inventory_function' : inventory_etherbox_temp,
+ 'check_function' : check_etherbox_temp,
+ 'service_description' : 'Temperature %s',
+ 'has_perfdata' : True,
+ 'snmp_info' : [(".1.3.6.1.4.1.14848.2.1.7.1.2", [
"" ]),
+ (".1.3.6.1.4.1.14848.2.1.9.1.2", [ OID_END,
"" ])],
+ # From firmware version 1.21 on the ethernetbox 2 from
MessPC
+ # supports additional temperature sensors. The sensor
data are
+ # located under these OIDs. There are no standard OIDs
for
+ # disk space reasons.
+ 'snmp_scan_function' : lambda oid: oid(".1.3.6.1.2.1.1.1.0")
== "" and \
+ "Version 1.21" in
oid(".1.3.6.1.4.1.14848.2.1.1.1.0", ""),
+ 'default_levels_variable' : 'etherbox_temp_default_levels',
+ 'group' : 'temperature',
+ 'includes' : [ "temperature.include" ],
+}