Module: check_mk
Branch: master
Commit: 0fe82c6850364b701f3a6170baa3f6f49f8c7c43
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0fe82c6850364b…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Jan 15 09:14:24 2018 +0100
5614 FIX raritan_pdu_ocprot: Fixed wrong scaling of current value
Change-Id: Ic063695763229c2805001efd629f6b393441e8cc
---
.werks/5614 | 10 +++++++++
checks/raritan_pdu_ocprot | 53 ++++++++++++++++++++++++++++++-----------------
2 files changed, 44 insertions(+), 19 deletions(-)
diff --git a/.werks/5614 b/.werks/5614
new file mode 100644
index 0000000..6864076
--- /dev/null
+++ b/.werks/5614
@@ -0,0 +1,10 @@
+Title: raritan_pdu_ocprot: Fixed wrong scaling of current value
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i3
+Date: 1516004028
+Class: fix
+
+
diff --git a/checks/raritan_pdu_ocprot b/checks/raritan_pdu_ocprot
index 58427c8..9eb6d36 100644
--- a/checks/raritan_pdu_ocprot
+++ b/checks/raritan_pdu_ocprot
@@ -27,30 +27,44 @@
raritan_pdu_ocprot_current_default_levels = (14.0, 15.0)
# Example for info:
-# [['1.1.1', '4', '0'],
-# ['1.1.15', '1', '0'],
-# ['1.2.1', '4', '0'],
-# ['1.2.15', '1', '0'],
-# ['1.3.1', '4', '0'],
-# ['1.3.15', '1', '0'],
-# ['1.4.1', '4', '0'],
-# ['1.4.15', '1', '0'],
-# ['1.5.1', '4', '0'],
-# ['1.5.15', '1', '0'],
-# ['1.6.1', '4', '0'],
-# ['1.6.15', '1', '0']]
+# [[[u'1.1.1', u'4', u'0'],
+# [u'1.1.15', u'1', u'0'],
+# [u'1.2.1', u'4', u'0'],
+# [u'1.2.15', u'1', u'0'],
+# [u'1.3.1', u'4', u'70'],
+# [u'1.3.15', u'1', u'0'],
+# [u'1.4.1', u'4', u'0'],
+# [u'1.4.15', u'1', u'0'],
+# [u'1.5.1', u'4', u'0'],
+# [u'1.5.15', u'1', u'0'],
+# [u'1.6.1', u'4', u'0'],
+# [u'1.6.15', u'1', u'0']],
+# [[u'1'],
+# [u'0'],
+# [u'1'],
+# [u'0'],
+# [u'1'],
+# [u'0'],
+# [u'1'],
+# [u'0'],
+# [u'1'],
+# [u'0'],
+# [u'1'],
+# [u'0']]]
# Raritan implements a strange way of indexing here. The two last components
# of the OID should really be swapped!
def parse_raritan_pdu_ocprot(info):
+ flattened_info = [[end_oid, state, value, scale]
+ for (end_oid, state, value), (scale,) in zip(info[0], info[1])]
parsed = {}
- for end_oid, state, value in info:
+ for end_oid, state, value, scale in flattened_info:
protector_id = "C" + end_oid.split(".")[1] # 1.5.1 -->
Item will be "C5"
if end_oid.endswith(".15"):
parsed.setdefault(protector_id, {})["state"] = state
elif end_oid.endswith(".1"):
- parsed.setdefault(protector_id, {})["current"] = float(value) / 10
+ parsed.setdefault(protector_id, {})["current"] = float(value) /
pow(10, int(scale))
return parsed
@@ -94,10 +108,11 @@ check_info["raritan_pdu_ocprot"] = {
"check_function" : check_raritan_pdu_ocprot,
"service_description" : "Overcurrent Protector %s",
"group" : "ocprot_current",
- "snmp_info" : (".1.3.6.1.4.1.13742.6.5.3.3.1", [
- OID_END,
- "3",
- "4",
- ]),
+ "snmp_info" : [(".1.3.6.1.4.1.13742.6.5.3.3.1",
[
+ OID_END,
+ "3",
+ "4",
+ ]),
+ (".1.3.6.1.4.1.13742.6.3.4.4.1",
["7"])],
"snmp_scan_function" : lambda oid: "13742" in
oid(".1.3.6.1.2.1.1.2.0"),
}