Module: check_mk
Branch: master
Commit: db9960c6b70b6c2bd4790d3a237d31d236a99bec
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=db9960c6b70b6c…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Dec 19 08:25:19 2016 +0100
4171 FIX perle_psmu: fixed value error
Some power supplies report no power or voltage if the device state is failed.
Change-Id: I20317c70e1d09407bc50a2c33a8ea05806cfd69f
---
.werks/4171 | 10 ++++++++++
ChangeLog | 1 +
checks/perle_psmu | 10 +++++++---
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/.werks/4171 b/.werks/4171
new file mode 100644
index 0000000..cb6bd1d
--- /dev/null
+++ b/.werks/4171
@@ -0,0 +1,10 @@
+Title: perle_psmu: fixed value error
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i4
+Date: 1482132240
+
+Some power supplies report no power or voltage if the device state is failed.
diff --git a/ChangeLog b/ChangeLog
index bab5544..79fe8bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
1.4.0i4:
Checks & Agents:
* 4104 veeam_tapejobs: New check to monitor Veeam tape jobs
+ * 4171 FIX: perle_psmu: fixed value error...
1.4.0i3:
diff --git a/checks/perle_psmu b/checks/perle_psmu
index 5a1c9a1..85b1ae2 100644
--- a/checks/perle_psmu
+++ b/checks/perle_psmu
@@ -50,13 +50,17 @@ def parse_perle_psmu(info):
parsed = {}
for index, name, serial, psu_status, voltage_str, power_str, fan_status in info:
- parsed.setdefault("%s %s" % (index, name), {
+ itemname = "%s %s" % (index, name)
+ parsed.setdefault(itemname, {
"serial" : serial,
"fanstate" : map_states[fan_status],
"psustate" : map_states[psu_status],
- "power" : float(power_str),
- "voltage" : float(voltage_str)
})
+ for what, value_str in [ ("power", power_str), ("voltage",
voltage_str) ]:
+ try:
+ parsed[itemname].setdefault(what, float(value_str))
+ except ValueError:
+ pass
return parsed