Module: check_mk
Branch: master
Commit: 2be69dfe5ced7005ce76ebcdf1634e5c1b7b1e79
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2be69dfe5ced70…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Fri Apr 11 09:49:51 2014 +0200
ibm_svc_enclosurestats.power: New check for power consumption of enclosures of IBM SVC /
Storwize V3700 / V7000 devices
---
.werks/807 | 8 +++++
ChangeLog | 1 +
checkman/ibm_svc_enclosurestats.power | 24 ++++++++++++++
checks/ibm_svc_enclosurestats | 35 ++++++++++++++++++++
.../check_mk-ibm_svc_enclosurestats.power.php | 35 ++++++++++++++++++++
web/plugins/perfometer/check_mk.py | 6 ++++
6 files changed, 109 insertions(+)
diff --git a/.werks/807 b/.werks/807
new file mode 100644
index 0000000..7846f1e
--- /dev/null
+++ b/.werks/807
@@ -0,0 +1,8 @@
+Title: ibm_svc_enclosurestats.power: New check for power consumption of enclosures of IBM
SVC / Storwize V3700 / V7000 devices
+Level: 1
+Component: checks
+Version: 1.2.5i3
+Date: 1397202560
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 302cf17..acdcaf6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,7 @@
* 0804 ibm_svc_portfc: New check for status of FC Ports in IBM SVC / Storwize V3700 /
V7000 devices
* 0805 ibm_svc_enclosure: New Check for Enclosures, Canisters and PSUs in IBM SVC /
Storwize V3700 / V7000 devices
* 0806 ibm_svc_enclosurestats.temp: New Check for temperature in enclosures of IBM
SVC / Storwize V3700 / V7000 devices
+ * 0807 ibm_svc_enclosurestats.power: New check for power consumption of enclosures of
IBM SVC / Storwize V3700 / V7000 devices
* 0777 FIX: special agent emcvnx: did not work with security file authentication...
* 0786 FIX: zfsget: fixed compatibility with older Solaris agents...
* 0809 FIX: brocade_fcport: Fixed recently introduced problem with port speed
detection
diff --git a/checkman/ibm_svc_enclosurestats.power
b/checkman/ibm_svc_enclosurestats.power
new file mode 100644
index 0000000..586f07a
--- /dev/null
+++ b/checkman/ibm_svc_enclosurestats.power
@@ -0,0 +1,24 @@
+title: IBM SVC / Storwize V3700 / V7000: Power Consumption of Enclosures
+agents: ibm_svc
+catalog: hw/storagehw/ibm
+license: GPL
+distribution: check_mk
+description:
+ Displays the power consumption of enclosures of an IBM SVC / Storwize V3700 / V7000
+ device in watt.
+
+ The check is only for reporting and returns always {OK}.
+
+ Please note: You need the Special Agent agent_ibmsvc to retrieve the monitoring
+ data from the device. Your monitoring user must be able to SSH to the device
+ with SSH Key Authentification. Please exchange SSH key. The Special Agent itself
+ can be configured by WATO.
+
+item:
+ The ID of the enclosure.
+
+inventory:
+ Creates one check per enclosure.
+
+perfdata:
+ One value: The power consumption in watt.
diff --git a/checks/ibm_svc_enclosurestats b/checks/ibm_svc_enclosurestats
index 6dcd670..4483a54 100644
--- a/checks/ibm_svc_enclosurestats
+++ b/checks/ibm_svc_enclosurestats
@@ -84,3 +84,38 @@ check_info["ibm_svc_enclosurestats.temp"] = {
}
#.
+# .--power---------------------------------------------------------------.
+# | |
+# | _ __ _____ _____ _ __ |
+# | | '_ \ / _ \ \ /\ / / _ \ '__| |
+# | | |_) | (_) \ V V / __/ | |
+# | | .__/ \___/ \_/\_/ \___|_| |
+# | |_| |
+# '----------------------------------------------------------------------'
+
+def inventory_ibm_svc_enclosurestats_power(info):
+ inventory = []
+ for enclosure_id, stat_name, stat_current, stat_peak, stat_peak_time in info:
+ if stat_name == "power_w":
+ inventory.append( (enclosure_id, None) )
+ return inventory
+
+def check_ibm_svc_enclosurestats_power(item, _no_params, info):
+ perfdata = []
+
+ for enclosure_id, stat_name, stat_current, stat_peak, stat_peak_time in info:
+ if enclosure_id == item and stat_name == "power_w":
+ stat_current = int(stat_current)
+ perfdata = [ ('power', str(stat_current)+"Watt") ]
+ return 0, "Enclosure %s Power Consumption is %s Watt" %
(enclosure_id, stat_current), perfdata
+
+ return 3, "Power for enclosure %s not found in agent output" % item
+
+check_info["ibm_svc_enclosurestats.power"] = {
+ "check_function" : check_ibm_svc_enclosurestats_power,
+ "inventory_function" : inventory_ibm_svc_enclosurestats_power,
+ "service_description" : "IBM SVC Power Enclosure %s",
+ "has_perfdata" : True,
+}
+
+#.
diff --git a/pnp-templates/check_mk-ibm_svc_enclosurestats.power.php
b/pnp-templates/check_mk-ibm_svc_enclosurestats.power.php
new file mode 100644
index 0000000..07c03e5
--- /dev/null
+++ b/pnp-templates/check_mk-ibm_svc_enclosurestats.power.php
@@ -0,0 +1,35 @@
+<?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 \"Watt\" -l 0 -u 60 --title \"$hostname
/ $servicedesc\" ";
+
+$def[1] = "DEF:var1=$RRDFILE[1]:$DS[1]:MAX ";
+$def[1] .= "AREA:var1#800040:\"Power\:\" ";
+$def[1] .= "GPRINT:var1:LAST:\"%2.0lfW\" ";
+$def[1] .= "LINE1:var1#800040:\"\" ";
+$def[1] .= "GPRINT:var1:MAX:\"(Max\: %2.0lfW,\" ";
+$def[1] .= "GPRINT:var1:AVERAGE:\"Avg\: %2.0lfW)\" ";
+
+?>
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 8a1290f..0738ddb 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -918,6 +918,12 @@ def perfometer_check_mk_ibm_svc_cache(row, check_command,
perf_data):
perfometers["check_mk-ibm_svc_nodestats.cache"] =
perfometer_check_mk_ibm_svc_cache
perfometers["check_mk-ibm_svc_systemstats.cache"] =
perfometer_check_mk_ibm_svc_cache
+def perfometer_check_mk_ibm_svc_power(row, check_command, perf_data):
+ watt = int(perf_data[0][1])
+ text = "%s Watt" % watt
+ return text, perfometer_logarithmic(watt, 150, 2, "#60f020")
+perfometers["check_mk-ibm_svc_enclosurestats.power"] =
perfometer_check_mk_ibm_svc_power
+
def perfometer_licenses_percent(row, check_command, perf_data):
licenses = float(perf_data[0][1])
max_avail = float(perf_data[0][5])