Module: check_mk
Branch: master
Commit: e70900157d51ba41ef27e98ad6254c17d0b80221
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e70900157d51ba…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Wed Jan 15 11:22:12 2014 +0100
Fix: stulz_humidity output and apc_humidity template
---
checks/stulz_humidity | 27 ++++++++-------------
pnp-templates/check_mk-apc_humidity.php | 39 +------------------------------
2 files changed, 11 insertions(+), 55 deletions(-)
diff --git a/checks/stulz_humidity b/checks/stulz_humidity
index dad7c61..87e267c 100644
--- a/checks/stulz_humidity
+++ b/checks/stulz_humidity
@@ -34,23 +34,16 @@ def check_stulz_humidity(item, params, info):
if line[0] == item:
warnlow, critlow, warnhigh, crithigh = params
humidity = savefloat(line[1])/10
- state = 0
- msg = ""
- if humidity >= crithigh:
- state = 2
- msg = "to high (Levels Warning/Critical %d/%d) " % ( warnhigh,
crithigh )
- elif humidity >= warnhigh:
- state = 1
- msg = "to high (Levels Warning/Critical %d/%d) " % ( warnhigh,
crithigh )
- elif humidity <= warnlow and humidity > critlow:
- state = 1
- msg = "to low (Levels Warning/Critical %d/%d) " % ( warnlow,
critlow )
- elif humidity <= critlow:
- state = 2
- msg = "to low (Levels Warning/Critical %d/%d) " % ( warnlow,
critlow )
- message = " Current Humidity: %.2f%% %s" % ( humidity, msg )
- perf = [ ('humidity', humidity, critlow, warnlow, warnhigh, crithigh
) ]
- return state, message, perf
+ infotext = "%s%%" % humidity + " (warn/crit below %.1f/%.1f or
above %.1f/%.1f %%" % \
+
+ 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, "No information found about the device"
check_info["stulz_humidity"] = {
diff --git a/pnp-templates/check_mk-apc_humidity.php
b/pnp-templates/check_mk-apc_humidity.php
deleted file mode 100644
index aba6a03..0000000
--- a/pnp-templates/check_mk-apc_humidity.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?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 \"Percent\" --title \"$servicedesc\"
";
-
-$def[1] = "DEF:var1=$RRDFILE[1]:$DS[1]:MAX ";
-$def[1] .= "LINE2:var1#2080ff:\"Humidity\:\" ";
-$def[1] .= "GPRINT:var1:LAST:\"%2.0lf%%\" ";
-$def[1] .= "GPRINT:var1:AVERAGE:\"(Avg\: %2.0lf%%,\" ";
-$def[1] .= "GPRINT:var1:MIN:\"Min\: %2.0lf%%,\" ";
-$def[1] .= "GPRINT:var1:MAX:\"Max\: %2.0lf%%)\" ";
-$def[1] .= "HRULE:$CRIT[1]#FFFF00 ";
-$def[1] .= "HRULE:$WARN[1]#FF0000 ";
-$def[1] .= "HRULE:$MIN[1]#FFFF00 ";
-$def[1] .= "HRULE:$MAX[1]#FF0000 ";
-?>
diff --git a/pnp-templates/check_mk-apc_humidity.php
b/pnp-templates/check_mk-apc_humidity.php
new file mode 120000
index 0000000..152ceab
--- /dev/null
+++ b/pnp-templates/check_mk-apc_humidity.php
@@ -0,0 +1 @@
+check_mk-stulz_humidity.php
\ No newline at end of file