Module: check_mk
Branch: master
Commit: 6ed023abc9cbc197dc1f63f813f390448fc0e703
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6ed023abc9cbc1…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Wed Jul 9 18:26:41 2014 +0200
allnet_ip_sensoric.pressure: New Check for Pressure Sensors in ALLNET IP Sensoric devices
---
.werks/999 | 8 ++++
ChangeLog | 1 +
checkman/allnet_ip_sensoric.pressure | 19 ++++++++++
checks/allnet_ip_sensoric | 39 ++++++++++++++++++++
.../check_mk-allnet_ip_sensoric.pressure.php | 34 +++++++++++++++++
web/plugins/perfometer/check_mk.py | 9 ++++-
6 files changed, 109 insertions(+), 1 deletion(-)
diff --git a/.werks/999 b/.werks/999
new file mode 100644
index 0000000..9256964
--- /dev/null
+++ b/.werks/999
@@ -0,0 +1,8 @@
+Title: allnet_ip_sensoric.pressure: New Check for Pressure Sensors in ALLNET IP Sensoric
devices
+Level: 1
+Component: checks
+Version: 1.2.5i5
+Date: 1404923145
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 15a7861..7268491 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,7 @@
* 0628 raritan_pdu_inlet: now also monitors the three phases of the inlet
* 1073 sni_octopuse_cpu: added PNP graph definition and Perf-O-Meter
* 0178 mssql_tablespaces: It is now possible to define thresholds
+ * 0999 allnet_ip_sensoric.pressure: New Check for Pressure Sensors in ALLNET IP
Sensoric devices
* 0994 FIX: agent plugin smart: fixed syntax error
* 0989 FIX: logwatch.ec: Fix forwarding multiple messages via syslog/TCP...
* 0943 FIX: if.include: fixed incorrect traffic percentage values in the check output
of if checks...
diff --git a/checkman/allnet_ip_sensoric.pressure b/checkman/allnet_ip_sensoric.pressure
new file mode 100644
index 0000000..2e337b5
--- /dev/null
+++ b/checkman/allnet_ip_sensoric.pressure
@@ -0,0 +1,19 @@
+title: ALLNET IP Sensoric: Pressure Sensors
+agents: allnet_ip_sensoric
+catalog: hw/environment/allnet
+license: GPL
+distribution: check_mk
+description:
+ Reports values of Pressure Sensors in ALLNET IP Sensoric devices.
+
+ This check is for creating performace data only and allways returns {OK}.
+
+item:
+ If a name is reported for the sensor by the device: The name and the
+ sensor ID. Otherwise the sensor ID only.
+
+perfdata:
+ One value: The pressure in bars.
+
+inventory:
+ Creates one check for every Pressure Sensor (function = 16).
diff --git a/checks/allnet_ip_sensoric b/checks/allnet_ip_sensoric
index 0ade667..ae93589 100644
--- a/checks/allnet_ip_sensoric
+++ b/checks/allnet_ip_sensoric
@@ -253,3 +253,42 @@ check_info["allnet_ip_sensoric.humidity"] = {
}
#.
+# .--pressure------------------------------------------------------------.
+# | |
+# | _ __ _ __ ___ ___ ___ _ _ _ __ ___ |
+# | | '_ \| '__/ _ \/ __/ __| | | | '__/ _ \ |
+# | | |_) | | | __/\__ \__ \ |_| | | | __/ |
+# | | .__/|_| \___||___/___/\__,_|_| \___| |
+# | |_| |
+# '----------------------------------------------------------------------'
+
+def inventory_allnet_ip_sensoric_pressure(info):
+ parsed = allnet_ip_sensoric_parse(info)
+ inventory = []
+ for sensor in parsed.keys():
+ if "function" in parsed[sensor].keys() and
parsed[sensor]["function"] == "16":
+ item = allnet_ip_sensoric_compose_item(sensor, parsed[sensor])
+ inventory.append( (item, None) )
+ return inventory
+
+def check_allnet_ip_sensoric_pressure(item, _no_params, info):
+ parsed = allnet_ip_sensoric_parse(info)
+ sensor_id = "sensor" + re.sub(".+Sensor ", "", item)
+
+ if sensor_id not in parsed.keys():
+ return 3, "%s not found in agent output" % item
+
+ pressure = float(parsed[sensor_id]["value_float"]) / 1000
+
+ perfdata = [ ("pressure", str(pressure) + "bars", None, None, 0 )
]
+
+ return 0, "%s is %0.5f bars" % (item, pressure), perfdata
+
+check_info["allnet_ip_sensoric.pressure"] = {
+ "check_function" : check_allnet_ip_sensoric_pressure,
+ "inventory_function" : inventory_allnet_ip_sensoric_pressure,
+ "service_description" : "Pressure %s",
+ "has_perfdata" : True,
+}
+
+#.
diff --git a/pnp-templates/check_mk-allnet_ip_sensoric.pressure.php
b/pnp-templates/check_mk-allnet_ip_sensoric.pressure.php
new file mode 100644
index 0000000..aff37b7
--- /dev/null
+++ b/pnp-templates/check_mk-allnet_ip_sensoric.pressure.php
@@ -0,0 +1,34 @@
+<?php
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | 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.
+
+$opt[1] = "--vertical-label \"bars\" --title \"$hostname /
$servicedesc\" ";
+
+$def[1] = "DEF:var1=$RRDFILE[1]:$DS[1]:MAX ";
+$def[1] .= "LINE2:var1#2080ff:\"Pressure\:\" ";
+$def[1] .= "GPRINT:var1:LAST:\"%0.5lf bars\\n\" ";
+$def[1] .= "GPRINT:var1:AVERAGE:\"(Avg\: %0.5lf bars,\" ";
+$def[1] .= "GPRINT:var1:MIN:\"Min\: %0.5lf bars,\" ";
+$def[1] .= "GPRINT:var1:MAX:\"Max\: %0.5lf bars)\" ";
+?>
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index d2e85c5..a45e599 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -849,7 +849,7 @@ perfometers["check_mk-cmc_lcp"] = perfometer_cmc_lcp
def perfometer_humidity(row, check_command, perf_data):
humidity = float(perf_data[0][1])
- return "%3.1f%%" % humidity, perfometer_linear(humidity, '#6f2')
+ return "%3.1f% %" % humidity, perfometer_linear(humidity, '#6f2')
perfometers['check_mk-carel_uniflair_cooling'] = perfometer_humidity
perfometers['check_mk-cmciii.humidity'] = perfometer_humidity
@@ -1098,3 +1098,10 @@ def perfometer_allnet_ip_sensoric_tension(row, check_command,
perf_data):
return value, perfometer_linear(value, display_color)
perfometers["check_mk-allnet_ip_sensoric.tension"] =
perfometer_allnet_ip_sensoric_tension
+
+def perfometer_pressure(row, check_command, perf_data):
+ pressure = float(perf_data[0][1])
+ return "%0.5f bars" % pressure, perfometer_logarithmic(pressure, 1, 2,
"#da6")
+
+perfometers['check_mk-allnet_ip_sensoric.pressure'] = perfometer_pressure
+