raritan_pdu_ocprot.current:
Two new checks to monitor overcurrent
protectors of Raritan PDUs
Message-ID: <556f0a22.8id92xlQKwJklDDo%kb(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Module: check_mk
Branch: master
Commit: 4073518c404a1644fcd2596cca3ee4d7a0ef1534
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4073518c404a16…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Wed Jun 3 16:07:23 2015 +0200
#2216 raritan_pdu_ocprot, raritan_pdu_ocprot.current: Two new checks to monitor
overcurrent protectors of Raritan PDUs
raritan_pdu_ocprot monitors the status of overcurrent protectors,
raritan_pdu_ocprot.current the electrical current.
---
.werks/2216 | 9 +++
ChangeLog | 1 +
checkman/raritan_pdu_ocprot | 15 ++++
checkman/raritan_pdu_ocprot.current | 17 +++++
checks/raritan_pdu_ocprot | 127 ++++++++++++++++++++++++++++++++++
web/plugins/metrics/check_mk.py | 1 +
web/plugins/wato/check_parameters.py | 14 ++++
7 files changed, 184 insertions(+)
diff --git a/.werks/2216 b/.werks/2216
new file mode 100644
index 0000000..25b8ca3
--- /dev/null
+++ b/.werks/2216
@@ -0,0 +1,9 @@
+Title: raritan_pdu_ocprot, raritan_pdu_ocprot.current: Two new checks to monitor
overcurrent protectors of Raritan PDUs
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i2
+Date: 1433340363
+Class: feature
+
+raritan_pdu_ocprot monitors the status of overcurrent protectors,
raritan_pdu_ocprot.current the electrical current.
diff --git a/ChangeLog b/ChangeLog
index d8aa284..521e7d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
Checks & Agents:
* 2117 postfix_mailq: agent and check now retrieve and monitor active queue data as
well
* 2325 oracle_tablespaces: correctly handle case where check runs in clustered
mode...
+ * 2216 raritan_pdu_ocprot, raritan_pdu_ocprot.current: Two new checks to monitor
overcurrent protectors of Raritan PDUs...
* 2323 FIX: df: Fix new graphs for all filesystem checks in case of existing inode
information
* 2305 FIX: agent_vsphere, esx_vsphere_sensors: now able to handle sensor names with
semicolon...
diff --git a/checkman/raritan_pdu_ocprot b/checkman/raritan_pdu_ocprot
new file mode 100644
index 0000000..46fad38
--- /dev/null
+++ b/checkman/raritan_pdu_ocprot
@@ -0,0 +1,15 @@
+title: Raritan PX-2000 family PDU overcurrent protector status
+agents: snmp
+catalog: hw/other
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the electrical current of overcurrent protectors
+ of the Raritan PX-2000 family of intelligent rack power distribution
+ units (iPDUs).
+
+item:
+ The ID of the Overcurrent protector, eg. C1.
+
+inventory:
+ One check per overcurrent protector is created.
diff --git a/checkman/raritan_pdu_ocprot.current b/checkman/raritan_pdu_ocprot.current
new file mode 100644
index 0000000..07e3d83
--- /dev/null
+++ b/checkman/raritan_pdu_ocprot.current
@@ -0,0 +1,17 @@
+title: Raritan PX-2000 family PDU overcurrent protector status
+agents: snmp
+catalog: hw/other
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the current of overcurrent protectors of the Raritan PX-2000
+ family of intelligent rack power distribution units (iPDUs).
+
+item:
+ The ID of the Overcurrent protector, eg. C1.
+
+perfdata:
+ One value: The current current in Ampère.
+
+inventory:
+ One check per overcurrent protector is created.
diff --git a/checks/raritan_pdu_ocprot b/checks/raritan_pdu_ocprot
new file mode 100644
index 0000000..1a18ad9
--- /dev/null
+++ b/checks/raritan_pdu_ocprot
@@ -0,0 +1,127 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 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.
+
+
+def parse_raritan_pdu_ocprot(info):
+ parsed = {}
+ for line in info:
+ if line[0].endswith("15"):
+ ocprotid = "C" + line[0].split(".")[1]
+ if parsed.get(ocprotid) == None:
+ parsed[ocprotid] = {}
+ parsed[ocprotid]["state"] = line[1]
+ elif line[0].endswith("1"):
+ ocprotid = "C" + line[0].split(".")[1]
+ if parsed.get(ocprotid) == None:
+ parsed[ocprotid] = {}
+ parsed[ocprotid]["current"] = float(line[2]) / 10
+ return parsed
+
+
+#.
+# .--Current-------------------------------------------------------------.
+# | ____ _ |
+# | / ___| _ _ __ _ __ ___ _ __ | |_ |
+# | | | | | | | '__| '__/ _ \ '_ \| __| |
+# | | |__| |_| | | | | | __/ | | | |_ |
+# | \____\__,_|_| |_| \___|_| |_|\__| |
+# | |
+# '----------------------------------------------------------------------'
+
+raritan_pdu_ocprot_current_default_levels = (14.0, 15.0)
+
+
+def inventory_raritan_pdu_ocprot_current(parsed):
+ for ocprotid in parsed:
+ yield ocprotid, "raritan_pdu_ocprot_current_default_levels"
+
+
+def check_raritan_pdu_ocprot_current(item, params, parsed):
+ current = parsed[item]["current"]
+ warn, crit = params
+
+ infotext = "%.1f A" % current
+ levelstext = " (warn/crit at %.1f/%.1f A)" % (warn, crit)
+
+ if current >= crit:
+ status = 2
+ infotext += levelstext
+ elif current >= warn:
+ status = 1
+ infotext += levelstext
+ else:
+ status = 0
+
+ perfdata = [ ("current", current, warn, crit) ]
+
+ return status, infotext, perfdata
+
+
+check_info["raritan_pdu_ocprot.current"] = {
+ "inventory_function" : inventory_raritan_pdu_ocprot_current,
+ "check_function" : check_raritan_pdu_ocprot_current,
+ "service_description" : "Overcurrent Protector Current
%s",
+ "has_perfdata" : True,
+ "group" : "ocprot_current",
+}
+
+
+#.
+# .--Status--------------------------------------------------------------.
+# | ____ _ _ |
+# | / ___|| |_ __ _| |_ _ _ ___ |
+# | \___ \| __/ _` | __| | | / __| |
+# | ___) | || (_| | |_| |_| \__ \ |
+# | |____/ \__\__,_|\__|\__,_|___/ |
+# | |
+# '----------------------------------------------------------------------'
+
+def inventory_raritan_pdu_ocprot(parsed):
+ for ocprotid in parsed:
+ yield ocprotid, None
+
+
+def check_raritan_pdu_ocprot(item, _no_params, parsed):
+ states = {
+ "-1" : (3, "Overcurrent protector information is
unavailable"),
+ "0" : (2, "Overcurrent protector is open"),
+ "1" : (0, "Overcurrent protector is closed"),
+ }
+ return states[parsed[item]["state"]]
+
+
+check_info["raritan_pdu_ocprot"] = {
+ "parse_function" : parse_raritan_pdu_ocprot,
+ "inventory_function" : inventory_raritan_pdu_ocprot,
+ "check_function" : check_raritan_pdu_ocprot,
+ "service_description" : "Overcurrent Protector Status %s",
+ "snmp_info" : (".1.3.6.1.4.1.13742.6.5.3.3.1", [
+ OID_END,
+ "3",
+ "4",
+ ]),
+ "snmp_scan_function" : lambda oid: "13742" in
oid(".1.3.6.1.2.1.1.2.0"),
+}
diff --git a/web/plugins/metrics/check_mk.py b/web/plugins/metrics/check_mk.py
index af0b41b..6d6aaa8 100644
--- a/web/plugins/metrics/check_mk.py
+++ b/web/plugins/metrics/check_mk.py
@@ -1412,6 +1412,7 @@ check_metrics["check_mk-apc_rackpdu_power"]
= { "amperage" :
check_metrics["check_mk-apc_ats_output"] = {
"volt" : { "name" : "voltage" }, "watt" : {
"name" : "power"}, "ampere": { "name":
"current"}, "load_perc" : { "name": "output_load"
}}
check_metrics["check_mk-raritan_pdu_inlet"] = {}
check_metrics["check_mk-raritan_pdu_inlet_summary"] = {}
+check_metrics["check_mk-raritan_pdu_ocprot.current"] = {}
check_metrics["check_mk-ups_socomec_outphase"] = {}
check_metrics["check_mk-ucs_bladecenter_psu.switch_power"] = {}
check_metrics["check_mk-bluenet_meter"] = {}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index be90cb0..df7cc4a 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -456,6 +456,20 @@ register_check_parameters(
match_type = "first",
)
+register_check_parameters(
+ subgroup_environment,
+ "ocprot_current",
+ _("Electrical Current of Overcurrent Protectors"),
+ Tuple(
+ elements = [
+ Float(title = _("Warning at"), unit = u"A", default_value
= 14.0),
+ Float(title = _("Critical at"), unit = u"A",
default_value = 15.0),
+ ],
+ ),
+ TextAscii(title = _("The Index of the Overcurrent Protector")),
+ match_type = "first",
+)
+
#.