Module: check_mk
Branch: master
Commit: e7aa4f286a0e20bb49822ac164d8deaee132da3e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e7aa4f286a0e20…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Tue Jul 17 13:04:03 2018 +0200
Don't change input variable parsed
Change-Id: I4d3732adbb78fe4ad0997f9c3b2392427c5ddc72
---
checks/ucs_bladecenter_psu | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/checks/ucs_bladecenter_psu b/checks/ucs_bladecenter_psu
index a02426c..d8196ae 100644
--- a/checks/ucs_bladecenter_psu
+++ b/checks/ucs_bladecenter_psu
@@ -129,13 +129,17 @@ def check_ucs_bladecenter_psu_switch_power(item, params, parsed):
return 3, "Switch power info not available"
# Convert fields
- for old, new in [ ("Current", "current"),
- ("PowerAvg", "power"),
- ("Voltage", "voltage") ]:
- psu[new] = (float(psu[old]), None)
- del psu[old]
+ KEY_MAP = {"Current": "current",
+ "PowerAvg": "power",
+ "Voltage": "voltage"}
- return check_elphase(item, params, {item: psu})
+ psu_new = {}
+ for k, v in psu.iteritems():
+ if k in KEY_MAP:
+ k, v = KEY_MAP[k], (float(v), None)
+ psu_new[k] = v
+
+ return check_elphase(item, params, {item: psu_new})
check_info["ucs_bladecenter_psu.switch_power"] = {
'inventory_function': inventory_ucs_bladecenter_psu_switch_power,