Module: check_mk
Branch: master
Commit: fa2801b2ebf1b985a38a2f828e8024fed04d7bd1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fa2801b2ebf1b9…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon May 23 13:49:41 2016 +0200
3609 apc_rackpdu_power: now upper levels for electrical current are confiugurable
---
.werks/3609 | 9 +++++++
ChangeLog | 1 +
checkman/apc_rackpdu_power | 15 +++++------
checks/apc_rackpdu_power | 61 +++++++++++++++++++++++---------------------
4 files changed, 48 insertions(+), 38 deletions(-)
diff --git a/.werks/3609 b/.werks/3609
new file mode 100644
index 0000000..c422ac9
--- /dev/null
+++ b/.werks/3609
@@ -0,0 +1,9 @@
+Title: apc_rackpdu_power: now upper levels for electrical current are confiugurable
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.9i1
+Date: 1464004147
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 012fc5a..abbb911 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -82,6 +82,7 @@
* 3533 rds_licenses: Monitors used remote desktop licenses...
* 3606 saprouter_cert: new check which monitors the age of validity of a SAP router
certificate...
* 3135 skype, skype.xmpp_proxy, skype.conferencing, skype.sip_stack: added furter
metrics and adjusted default levels
+ * 3609 apc_rackpdu_power: now upper levels for electrical current are confiugurable
* 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/apc_rackpdu_power b/checkman/apc_rackpdu_power
index 00233fd..8e79581 100644
--- a/checkman/apc_rackpdu_power
+++ b/checkman/apc_rackpdu_power
@@ -1,20 +1,17 @@
-title: APC PDU: Power and Voltage
+title: APC PDU: electrical current
agents: snmp
catalog: hw/power/apc
license: GPL
distribution: check_mk
description:
- Monitors Power and Voltage on APC PDU Units.
- This check will alert if the amperage on the input exceeds
- the limit reported by the PDU. It knows either {OK} or {CRIT}
- states.
+ This check monitors the electrical current of APC PDU units.
+
+ The device sends thresholds WARN and CRIT itself. If one of these
+ will be excedeed then the check goes WARN or CRIT. Otherwise it is OK.
+ There are no default levels. Upper levels can be configured.
item:
The name of the PDU as set in the PDU
-perfdata:
- Amps, defined MAX Amp value
-
inventory:
One service per PDU
-
diff --git a/checks/apc_rackpdu_power b/checks/apc_rackpdu_power
index 094f385..8eeb397 100644
--- a/checks/apc_rackpdu_power
+++ b/checks/apc_rackpdu_power
@@ -24,42 +24,45 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-
# Originally written / contributed by Dave Cundiff
+# .1.3.6.1.4.1.318.1.1.12.1.1.0 "sf9pdu1" -->
PowerNet-MIB::rPDUIdentName.0
+# .1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.1 160 --> PowerNet-MIB::rPDULoadStatusLoad.1
(measured in tenths of Amps)
+# .1.3.6.1.4.1.318.1.1.12.2.2.1.1.3.1 12 -->
PowerNet-MIB::rPDULoadPhaseConfigNearOverloadThreshold.phase1
+# .1.3.6.1.4.1.318.1.1.12.2.2.1.1.4.1 16 -->
PowerNet-MIB::rPDULoadPhaseConfigOverloadThreshold.phase1
+
-def inventory_apc_rackpdu_power(checkname, info):
- inventory = []
- for host, amperage, min, max in info:
- inventory.append((host, None))
- return inventory
+def parse_apc_rackpdu_power(info):
+ parsed = {}
+ for host, amperage_str, warn, crit in info:
+ amperage = float(amperage_str) / 10
+ if amperage >= int(crit):
+ status_info = (amperage, (2, "crit exceeded"))
+ elif amperage >= int(warn):
+ status_info = (amperage, (1, "warn exceeded"))
+ else:
+ status_info = amperage
-def check_apc_rackpdu_power(item, _no_params, info):
- for host, raw_amperage, min, max in info:
- amperage = float(raw_amperage) / 10
- if host == item:
- perfdata = [ ( "amperage", amperage, max ) ]
- if amperage >= max:
- return (2, "Amperage: %f - Overload possible" % amperage,
perfdata)
- else:
- return (0, "Amperage: %f" % amperage, perfdata)
+ parsed.setdefault(host, {"current" : status_info})
+ return parsed
-# Look for the APC management module and then dive into it's rackpdu tree
check_info["apc_rackpdu_power"] = {
- 'check_function': check_apc_rackpdu_power,
- 'inventory_function': inventory_apc_rackpdu_power,
- 'service_description': 'PDU %s',
- 'has_perfdata': True,
- 'snmp_info': ('.1.3.6.1.4.1.318.1.1.12', [
- '1.1.0',
- '2.3.1.1.2.1',
- '2.2.1.1.3.1',
- '2.2.1.1.4.1'
- ]),
- 'snmp_scan_function': lambda oid: \
- oid(".1.3.6.1.2.1.1.1.0").lower().startswith("apc web/snmp") \
- and oid(".1.3.6.1.4.1.318.1.1.12.1.1.0"),
+ 'parse_function' : parse_apc_rackpdu_power,
+ 'inventory_function' : inventory_elphase,
+ 'check_function' : check_elphase,
+ 'service_description' : 'PDU %s',
+ 'has_perfdata' : True,
+ 'snmp_info' : ('.1.3.6.1.4.1.318.1.1.12', [
+ '1.1.0', #
PowerNet-MIB::rPDUIdentName
+ '2.3.1.1.2.1', #
PowerNet-MIB::rPDULoadStatusLoad
+ '2.2.1.1.3.1', #
PowerNet-MIB::rPDULoadPhaseConfigNearOverloadThreshold
+ '2.2.1.1.4.1', #
PowerNet-MIB::rPDULoadPhaseConfigOverloadThreshold
+ ]),
+ 'snmp_scan_function' : lambda oid:
oid(".1.3.6.1.2.1.1.1.0").lower().startswith("apc web/snmp") and \
+
oid(".1.3.6.1.4.1.318.1.1.12.1.1.0"),
+ 'group' : 'el_inphase',
+ 'includes' : [ 'elphase.include' ],
}