Module: check_mk
Branch: master
Commit: b15c72b033483edf40c9eb3ec588423c4847705d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b15c72b033483e…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Mon Sep 16 12:26:22 2013 +0200
check_mk-ipmi.php: PNP template now displays correct units as delivered by the check
plugin (more generic approach now)
---
ChangeLog | 4 ++--
pnp-templates/check_mk-ipmi.php | 18 ++++++++++++------
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7139d8d..9027c3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -92,8 +92,8 @@
currently supported: temperature, humidity, switch contact and smoke sensors
* cisco_wlc_client: now supports low/high warn and crit levels
* cisco_wlc: now supports configuration options for missing AP
- * FIX: check_mk-ipmi.php: PNP template for Power_Meter now displays correct
- unit (Watts)
+ * FIX: check_mk-ipmi.php: PNP template now displays correct units as delivered
+ by the check plugin
Notifications:
diff --git a/pnp-templates/check_mk-ipmi.php b/pnp-templates/check_mk-ipmi.php
index 462e179..92130b2 100644
--- a/pnp-templates/check_mk-ipmi.php
+++ b/pnp-templates/check_mk-ipmi.php
@@ -23,18 +23,24 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-if (substr($NAME[1], 0, 11) == 'Power_Meter') {
- $vlabel = "--vertical-label 'Watts'";
-} elseif (substr($NAME[1], 0, 4) == 'Temp') {
+if ($UNIT[1] == 'degrees_C') {
+ $unit = "°C";
$vlabel = "--vertical-label 'Celsius'";
-} else {
+} elseif ($UNIT[1] == 'unspecified') {
+ $unit = "";
$vlabel = "";
+} else {
+ $unit = $UNIT[1];
+ $vlabel = "--vertical-label '$UNIT[1]'";
}
-$opt[1] = "$vlabel -l0 -u60 --title \"IPMI sensor $NAME[1] / $hostname\"
";
+$opt[1] = "$vlabel -l0 --title \"IPMI sensor $NAME[1] / $hostname\"
";
$def[1] = "DEF:value=$RRDFILE[1]:$DS[1]:MAX ";
-$def[1] .= "AREA:value#ffd040:\"Sensor $NAME[1] \\n\" ";
+$def[1] .= "AREA:value#ffd040:\"Sensor $NAME[1]\" ";
$def[1] .= "LINE:value#ff8000 ";
+$def[1] .= "GPRINT:value:LAST:\"%6.2lf $unit last\" " ;
+$def[1] .= "GPRINT:value:AVERAGE:\"%6.2lf $unit avg\" " ;
+$def[1] .= "GPRINT:value:MAX:\"%6.2lf $unit max\\n\" ";
?>