Module: check_mk
Branch: master
Commit: 97cb0b56e696ba6fe47720874201f6803491965a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=97cb0b56e696ba…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Mon Mar 31 14:44:55 2014 +0200
ibm_svc_nodestats.cpu_util: new check for CPU Utilization per Node on IBM SVC / V7000
devices
---
.werks/776 | 8 +++
ChangeLog | 1 +
checkman/ibm_svc_nodestats.cpu_util | 41 ++++++++++++
checks/ibm_svc_nodestats | 45 +++++++++++++
.../check_mk-ibm_svc_nodestats.cpu_util.php | 70 ++++++++++++++++++++
web/plugins/perfometer/check_mk.py | 1 +
6 files changed, 166 insertions(+)
diff --git a/.werks/776 b/.werks/776
new file mode 100644
index 0000000..8800222
--- /dev/null
+++ b/.werks/776
@@ -0,0 +1,8 @@
+Title: ibm_svc_nodestats.cpu_util: new check for CPU Utilization per Node on IBM SVC /
V7000 devices
+Level: 1
+Component: checks
+Version: 1.2.5i2
+Date: 1396269855
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 9305a36..a32df95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
* 0774 ibm_svc_nodestats.diskio: new check for disk troughput per node on IBM SVC /
V7000 devices
* 0775 ibm_svc_systemstats.diskio: new check for disk throughput in IBM SVC / V7000
devices in total
* 0764 lnx_quota: Added new check to monitor Linux File System Quota...
+ * 0776 ibm_svc_nodestats.cpu_util: new check for CPU Utilization per Node on IBM SVC
/ V7000 devices
* 0740 FIX: winperf_if: now able to handle bandwidth > 4GBit...
Multisite:
diff --git a/checkman/ibm_svc_nodestats.cpu_util b/checkman/ibm_svc_nodestats.cpu_util
new file mode 100644
index 0000000..8f87447
--- /dev/null
+++ b/checkman/ibm_svc_nodestats.cpu_util
@@ -0,0 +1,41 @@
+title: IBM SVC / V7000: CPU Utilization per Node
+agents: ibm_svc
+catalog: hw/storagehw/ibm
+license: GPL
+distribution: check_mk
+description:
+ Reports the CPU Utilization for each node of an IBM SVC / V7000 device.
+
+ The check returns {WARN} or {CRIT} if the utilization in percent is higher
+ then given levels and {OK} otherwise.
+
+item:
+ The name of the node.
+
+inventory:
+ Creates one check per node.
+
+perfdata:
+ One value: The utilization in percent, together with it's levels for
+ warn and crit.
+
+examples:
+ # set default levels to 70 and 80 percent:
+ ibm_svc_cpu_default_levels = (70.0, 80.0)
+
+ # Check CPU Utilization of Node SVC01 on a IBM SVC called my-svc with default levels
+ checks += [
+ ("my-svc", "ibm_svc_nodestats.cpu_util", 'SVC01',
ibm_svc_cpu_default_levels)
+ ]
+
+ # or use individual levels for warn and crit
+ checks += [
+ ("my-svc", "ibm_svc_nodestats.cpu_util", 'SVC01', (75.0,
85.0))
+ ]
+
+[parameters]
+parameters (float, float): levels of CPU utilization for {WARN} and {CRIT} in percent
+
+[configuration]
+ibm_svc_cpu_default_levels (float, float): The standard levels for {WARN} and
+ {CRIT}, preset to (80.0, 90.0)
diff --git a/checks/ibm_svc_nodestats b/checks/ibm_svc_nodestats
index 7dff6b6..cbf5f02 100644
--- a/checks/ibm_svc_nodestats
+++ b/checks/ibm_svc_nodestats
@@ -71,6 +71,15 @@
# 5:BLUBBSVC02:sas_io:0:0:140325134930
# [...]
+# .--disk IO-------------------------------------------------------------.
+# | _ _ _ ___ ___ |
+# | __| (_)___| | __ |_ _/ _ \ |
+# | / _` | / __| |/ / | | | | | |
+# | | (_| | \__ \ < | | |_| | |
+# | \__,_|_|___/_|\_\ |___\___/ |
+# | |
+# '----------------------------------------------------------------------'
+
# parses agent output into a structure like:
# {'Drives BLUBBSVC01': {'r_mb': 0, 'w_mb': 0},
# 'Drives BLUBBSVC02': {'r_mb': 0, 'w_mb': 0},
@@ -133,3 +142,39 @@ check_info["ibm_svc_nodestats.diskio"] = {
"has_perfdata" : True,
}
+#.
+# .--cpu-----------------------------------------------------------------.
+# | |
+# | ___ _ __ _ _ |
+# | / __| '_ \| | | | |
+# | | (__| |_) | |_| | |
+# | \___| .__/ \__,_| |
+# | |_| |
+# | |
+# '----------------------------------------------------------------------'
+
+ibm_svc_cpu_default_levels = ( 90.0, 95.0 )
+
+def inventory_ibm_svc_cpu(info):
+ inventory = []
+ for node_id, node_name, stat_name, stat_current, stat_peak, stat_peak_time in info:
+ if stat_name == "cpu_pc":
+ inventory.append( (node_name, "ibm_svc_cpu_default_levels") )
+ return inventory
+
+def check_ibm_svc_cpu(item, params, info):
+ for node_id, node_name, stat_name, stat_current, stat_peak, stat_peak_time in info:
+ if node_name == item and stat_name == "cpu_pc":
+ return check_cpu_util(int(stat_current), params)
+
+ return 3, "value cpu_pc not found in agent output for node %s" % item
+
+check_info["ibm_svc_nodestats.cpu_util"] = {
+ "check_function" : check_ibm_svc_cpu,
+ "inventory_function" : inventory_ibm_svc_cpu,
+ "service_description" : "CPU utilization %s",
+ "has_perfdata" : True,
+ "group" : "cpu_utilization_multiitem",
+ "includes" : [ "cpu_util.include" ],
+}
+#.
diff --git a/pnp-templates/check_mk-ibm_svc_nodestats.cpu_util.php
b/pnp-templates/check_mk-ibm_svc_nodestats.cpu_util.php
new file mode 100644
index 0000000..a1a651f
--- /dev/null
+++ b/pnp-templates/check_mk-ibm_svc_nodestats.cpu_util.php
@@ -0,0 +1,70 @@
+<?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.
+
+# Do not depend on numbers, use names
+$RRD = array();
+foreach ($NAME as $i => $n) {
+ $RRD[$n] = "$RRDFILE[$i]:$DS[$i]:MAX";
+ $WARN[$n] = $WARN[$i];
+ $CRIT[$n] = $CRIT[$i];
+ $MIN[$n] = $MIN[$i];
+ $MAX[$n] = $MAX[$i];
+}
+
+$num_threads = $MAX[1];
+
+$opt[1] = "--vertical-label 'Utilization %' -l0 -u 100 --title
\"$hostname / $servicedesc\" ";
+
+$def[1] = "DEF:perc=$RRD[util] "
+ . "CDEF:util=perc,$num_threads,*,100,/ "
+ ;
+
+$def[1] .= "AREA:util#60f020:\"Utilization\:\" "
+ . "LINE:util#50b01a "
+ . "GPRINT:perc:LAST:\"%.1lf%%\" "
+ . "GPRINT:perc:MIN:\"min\: %.1lf%%\" "
+ . "GPRINT:perc:MAX:\"max\: %.1lf%%\\n\" "
+ ;
+
+
+if (isset($RRD["avg"])) {
+ $def[1] .= "DEF:aperc=$RRD[avg] ".
+ "CDEF:avg=aperc,$num_threads,*,100,/ ".
+ "LINE:avg#004000:\"Averaged\: \" ".
+ "GPRINT:aperc:LAST:\"%.1lf%%,\" ".
+ "GPRINT:aperc:MIN:\"min\: %.1lf%%,\" ".
+ "GPRINT:aperc:MAX:\"max\: %.1lf%%\\n\" ".
+ "";
+}
+
+if ($WARN['util']) {
+ $def[1] .= "HRULE:$WARN[1]#fff000:\"Warn at $WARN[util]% \" "
+ . "HRULE:$CRIT[1]#ff0000:\"Critical at $CRIT[util]%\\n\"
";
+}
+else {
+ $def[1] .= "COMMENT:\"\\n\" ";
+}
+
+?>
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index fb7a1e9..34f643a 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -475,6 +475,7 @@ perfometers["check_mk-hr_cpu"] = perfometer_cpu_utilization
perfometers["check_mk-innovaphone_cpu"] = perfometer_cpu_utilization
perfometers["check_mk-enterasys_cpu_util"] = perfometer_cpu_utilization
perfometers["check_mk-juniper_trpz_cpu_util"] = perfometer_cpu_utilization
+perfometers["check_mk-ibm_svc_nodestats.cpu_util"] =
perfometer_cpu_utilization
def perfometer_ps_perf(row, check_command, perf_data):
perf_dict = dict([(p[0], float(p[1])) for p in perf_data])