Module: check_mk
Branch: master
Commit: 3c6a1dcda82ee5a86c09aff4ba1950eccbe415a8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3c6a1dcda82ee5…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Tue Mar 25 13:59:47 2014 +0100
ibm_svc_license: New check for Licensing Status on IBM SVC / V7000 devices
---
.werks/768 | 8 +++
ChangeLog | 3 +-
checkman/ibm_svc_license | 16 ++++++
checks/ibm_svc_license | 73 ++++++++++++++++++++++++++++
pnp-templates/check_mk-ibm_svc_license.php | 37 ++++++++++++++
web/plugins/perfometer/check_mk.py | 13 +++++
6 files changed, 149 insertions(+), 1 deletion(-)
diff --git a/.werks/768 b/.werks/768
new file mode 100644
index 0000000..d4cdbd8
--- /dev/null
+++ b/.werks/768
@@ -0,0 +1,8 @@
+Title: ibm_svc_license: New check for Licensing Status on IBM SVC / V7000 devices
+Level: 1
+Component: checks
+Version: 1.2.5i1
+Date: 1395752352
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 4306759..04ffb59 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -125,10 +125,11 @@
* 0760 The windows agent contains meta information about version, manufacturer
etc....
* 0145 apc_symmetra: Changed naming of Batterie Temperature to System Temerature...
NOTE: Please refer to the migration notes!
- * 0598 kentix_temp, kentix_humidity: new checks for Kentix MultiSensor-Rack
* 0735 mem.win: now able to configure swap file levels
* 0146 innovaphone_priports_l1, innovaphone_priports_l2: New Checks for Innovaphone
PRI Ports
* 0707 ibm_svc_host: New check: Status of hosts an IBM SVC / V7000 presents volumes
to
+ * 0598 kentix_temp, kentix_humidity: new checks for Kentix MultiSensor-Rack
+ * 0768 ibm_svc_license: New check for Licensing Status on IBM SVC / V7000 devices
* 0103 FIX: services: Fixed bug with service inventory defined in main.mk...
* 0299 FIX: borcade_mlx_fan: Prettified output, handling "other" state now
* 0300 FIX: cisco_fru_power: Trying not to inventorize not plugged in FRUs...
diff --git a/checkman/ibm_svc_license b/checkman/ibm_svc_license
new file mode 100644
index 0000000..96ee633
--- /dev/null
+++ b/checkman/ibm_svc_license
@@ -0,0 +1,16 @@
+title: IBM SVC / V7000: Licensing Status
+agents: ibm_svc
+catalog: hw/storagehw/ibm
+license: GPL
+distribution: check_mk
+description:
+ For every licensed feature on an IBM SVC / V7000 device, the number
+ of licenses is compared to the usage of licenses. The check returns
+ {CRIT} if the usage is higher than the licensing and {OK} otherwise.
+
+perfdata:
+ Two values are reported: The number of licenses you have and the number
+ of licenses used.
+
+inventory:
+ Creates one check for every licensable feature.
diff --git a/checks/ibm_svc_license b/checks/ibm_svc_license
new file mode 100644
index 0000000..4e7b6b4
--- /dev/null
+++ b/checks/ibm_svc_license
@@ -0,0 +1,73 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | 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.
+
+# Example output from agent:
+# Put here the example output from your TCP-Based agent. If the
+# check is SNMP-Based, then remove this section
+
+def parse_ibm_svc_license(info):
+ licenses = {}
+ for line in info:
+ if line[0].startswith("license_"):
+ license = line[0].replace("license_", "")
+ if not license in licenses.keys():
+ licenses[license] = [0.0, 0.0]
+ if line[1] == "off":
+ licenses[license][0] = 0.0
+ else:
+ licenses[license][0] = float(line[1])
+ if line[0].startswith("used_"):
+ license = line[0].replace("used_", "")
+ if not license in licenses.keys():
+ licenses[license] = [0.0, 0.0]
+ licenses[license][1] = float(line[1])
+ return licenses
+
+def inventory_ibm_svc_license(info):
+ inventory = []
+ licenses = parse_ibm_svc_license(info)
+ for license in licenses.keys():
+ inventory.append( (license, None) )
+ return inventory
+
+def check_ibm_svc_license(item, _no_params, info):
+ licenses = parse_ibm_svc_license(info)
+ licensed, used = licenses[item]
+ perfdata = [ ("licensed", licensed), ("used", used) ]
+
+ if used > licensed:
+ status = 2
+ else:
+ status = 0
+ return status, "%s %s licensed, %s used" % (item, licensed, used),
perfdata
+
+check_info["ibm_svc_license"] = {
+ "check_function" : check_ibm_svc_license,
+ "inventory_function" : inventory_ibm_svc_license,
+ "service_description" : "IBM SVC License %s",
+ "has_perfdata" : True,
+}
+
diff --git a/pnp-templates/check_mk-ibm_svc_license.php
b/pnp-templates/check_mk-ibm_svc_license.php
new file mode 100644
index 0000000..dd8a597
--- /dev/null
+++ b/pnp-templates/check_mk-ibm_svc_license.php
@@ -0,0 +1,37 @@
+<?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 "Licenses" --title "' .
$this->MACRO['DISP_HOSTNAME'] . ' / ' .
$this->MACRO['DISP_SERVICEDESC'] . ' per State" --lower=0';
+
+$def[1] = ""
+ . "DEF:licensed=$RRDFILE[1]:$DS[1]:MAX "
+ . "DEF:used=$RRDFILE[2]:$DS[2]:MAX "
+ . "AREA:used#008000:\"Used \" "
+ . "GPRINT:used:AVERAGE:\"% 6.0lf avg\" "
+ . "GPRINT:used:LAST:\"% 6.0lf last\\n\" "
+ . "LINE1:licensed#0000FF:\"Licensed \" "
+ . "GPRINT:licensed:AVERAGE:\"% 6.0lf avg\" "
+ . "GPRINT:licensed:LAST:\"% 6.0lf last\\n\" "
+ . "";
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index a06b7a7..dee8d8e 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -866,3 +866,16 @@ def perfometer_check_mk_ibm_svc_host(row, check_command, perf_data):
return "%d active" % active, h
perfometers["check_mk-ibm_svc_host"] = perfometer_check_mk_ibm_svc_host
+
+def perfometer_check_mk_ibm_svc_license(row, check_command, perf_data):
+ licensed = float(perf_data[0][1])
+ used = float(perf_data[1][1])
+ if used == 0 and licensed == 0:
+ return "0 of 0 used", perfometer_linear(100, "white")
+ elif licensed == 0:
+ return "completely unlicensed", perfometer_linear(100,
"silver")
+ else:
+ perc_used = 100 * used / licensed
+ return "%0.2f%% used" % perc_used, perfometer_linear(perc_used,
"silver")
+
+perfometers["check_mk-ibm_svc_license"] = perfometer_check_mk_ibm_svc_license