Module: check_mk
Branch: master
Commit: b843b998f5b978258119f093897e12e612f4f33b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b843b998f5b978…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue May 31 13:44:06 2016 +0200
3631 cisco_fru_powerusage: new check which monitors the current and power of Cisco Core
Switches which support the CISCO-ENTITY-FRU-CONTROL MIB
---
.werks/3631 | 9 ++++
ChangeLog | 1 +
checkman/cisco_fru_powerusage | 21 ++++++++
checks/cisco_fru_powerusage | 106 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 137 insertions(+)
diff --git a/.werks/3631 b/.werks/3631
new file mode 100644
index 0000000..4a04d7f
--- /dev/null
+++ b/.werks/3631
@@ -0,0 +1,9 @@
+Title: cisco_fru_powerusage: new check which monitors the current and power of Cisco Core
Switches which support the CISCO-ENTITY-FRU-CONTROL MIB
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.9i1
+Date: 1464695005
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 8cdf0c0..dbafec2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -94,6 +94,7 @@
* 3138 jolokia_metrics.cache_hits, jolokia_metrics.in_memory,
jolokia_metrics.off_heap, jolokia_metrics.on_disk, jolokia_metrics.writer: added checks
for monitoring of ehcache metrics through jolokia...
* 3628 emcvnx_mirrorview: new check which monitors the mirrorviews of EMC VNX storage
system...
* 3629 gude_relayport: new check which monitors the ON/OFF state of a GUDE Power
Control device
+ * 3631 cisco_fru_powerusage: new check which monitors the current and power of Cisco
Core Switches which support the CISCO-ENTITY-FRU-CONTROL MIB
* 3073 FIX: windows agent: relative paths to mrpe scripts are now treated as relative
to the agent installation directory...
* 3061 FIX: mk_jolokia: Fixed debugging of the agent plugin
* 3074 FIX: windows agent: fixed incorrect values for 32-bit performance counters
diff --git a/checkman/cisco_fru_powerusage b/checkman/cisco_fru_powerusage
new file mode 100644
index 0000000..6c1c575
--- /dev/null
+++ b/checkman/cisco_fru_powerusage
@@ -0,0 +1,21 @@
+title: Cisco Core Switches: Power usage
+agents: snmp
+catalog: hw/network/cisco
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the voltage, current and power usage
+ of Cisco Core Switches which support the
+ CISCO-ENTITY-FRU-CONTROL MIB.
+
+ There are no default levels set. Lower levels for voltage,
+ and upper levels for current and power can be configured.
+
+ Please note: voltage is shown as an information, it's determine
+ by the device itself: cefcPowerUnits from above MIB.
+
+item:
+ Can be system total or drawn or inline total or drawn.
+
+inventory:
+ One service per phase is created.
diff --git a/checks/cisco_fru_powerusage b/checks/cisco_fru_powerusage
new file mode 100644
index 0000000..96118d5
--- /dev/null
+++ b/checks/cisco_fru_powerusage
@@ -0,0 +1,106 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2016 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-
+# tails. 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.
+
+
+# .1.3.6.1.4.1.9.9.117.1.1.1.1.2.16 "centiAmpsAt12V"
+# some more examples (but we dont know all):
+# milliAmps12v
+# centiAmpsAt12V
+# Amps @ 12V
+# CentiAmps @ 12V
+# Amps @ 50
+# => calculate power = factor * amps * volt
+
+# .1.3.6.1.4.1.9.9.117.1.1.4.1.1.16 11333
+# .1.3.6.1.4.1.9.9.117.1.1.4.1.2.16 9666
+# .1.3.6.1.4.1.9.9.117.1.1.4.1.3.16 6000
+# .1.3.6.1.4.1.9.9.117.1.1.4.1.4.16 122
+
+# .1.3.6.1.4.1.9.9.117.1.1.4.1.1.13 11333
+# .1.3.6.1.4.1.9.9.117.1.1.4.1.2.13 5583
+# .1.3.6.1.4.1.9.9.117.1.1.4.1.3.13 6980
+# .1.3.6.1.4.1.9.9.117.1.1.4.1.4.13 0 <= exclude
+
+
+def parse_cisco_fru_powerusage(info):
+ powerunit, powervals = info
+ oidend, powerunit_str = powerunit[0]
+ factor_str, voltage_str = powerunit_str.lower().split("amps")
+
+ if "milli" in factor_str.lower():
+ factor = 0.001
+ elif "centi" in factor_str.lower():
+ factor = 0.01
+ else:
+ factor = 1.0
+
+ voltage = float(voltage_str.lower().replace("at", "").\
+ replace("@", "").replace("v",
"").strip())
+
+ parsed = {}
+ if oidend == powervals[0][0]:
+ system_total, system_drawn, inline_total, inline_drawn = map(float,
powervals[0][1:])
+ for what, val in [
+ ("system total", system_total), # Gesamtstrom
+ ("system drawn", system_drawn), # aufgenommene
Gesamtstromstaerke
+ ("inline total", inline_total),
+ ("inline drawn", inline_drawn)]:
+ parsed.setdefault(what, {
+ "power" : factor * val * voltage,
+ "current" : factor * val,
+ "voltage" : voltage,
+ })
+
+ return parsed
+
+
+def inventory_cisco_fru_powerusage(parsed):
+ for what, data in parsed.items():
+ if data["current"] > 0:
+ yield what, {}
+
+
+check_info['cisco_fru_powerusage'] = {
+ 'parse_function' : parse_cisco_fru_powerusage,
+ 'inventory_function' : inventory_cisco_fru_powerusage,
+ 'check_function' : check_elphase,
+ 'service_description' : 'FRU power usage %s',
+ 'has_perfdata' : True,
+ 'snmp_info' : [(".1.3.6.1.4.1.9.9.117.1.1.1.1.2", [
+ OID_END,
+ "", #
CISCO-ENTITY-FRU-CONTROL-MIB::cefcPowerUnits
+ ]),
+ (".1.3.6.1.4.1.9.9.117.1.1.4.1", [
+ OID_END,
+ "1", #
CISCO-ENTITY-FRU-CONTROL-MIB::cefcFRUTotalSystemCurrent
+ "2", #
CISCO-ENTITY-FRU-CONTROL-MIB::cefcFRUDrawnSystemCurrent
+ "3", #
CISCO-ENTITY-FRU-CONTROL-MIB::cefcFRUTotalInlineCurrent
+ "4", #
CISCO-ENTITY-FRU-CONTROL-MIB::cefcFRUDrawnInlineCurrent
+ ])],
+ 'snmp_scan_function' : lambda oid: "cisco" in
oid(".1.3.6.1.2.1.1.1.0").lower(),
+ 'includes' : [ "elphase.include" ],
+ 'group' : 'el_inphase'
+}