Module: check_mk
Branch: master
Commit: 862952d6743f186472135834cf31433a1e141ade
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=862952d6743f18…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Mar 22 14:28:29 2016 +0100
3305 FIX cmciii.phase: fixed wrong datatype handling
---
.werks/3305 | 10 ++++++++++
ChangeLog | 1 +
checks/cmciii | 15 +++++++++++----
3 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/.werks/3305 b/.werks/3305
new file mode 100644
index 0000000..f763fca
--- /dev/null
+++ b/.werks/3305
@@ -0,0 +1,10 @@
+Title: cmciii.phase: fixed wrong datatype handling
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1458653268
+
+
diff --git a/ChangeLog b/ChangeLog
index 2ef4f4e..6939861 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -100,6 +100,7 @@
* 3301 FIX: mrpe: Fixed exception "urllib not defined" when using Nagios as
core
* 3333 FIX: Predictive levels: Improved error handling in case no RRDs have been
created yet
* 3317 FIX: lnx_bonding: handle bogus output of 1.2.6 agents where >/dev/null is
missing after popd
+ * 3305 FIX: cmciii.phase: fixed wrong datatype handling
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/checks/cmciii b/checks/cmciii
index 860b261..5300a88 100644
--- a/checks/cmciii
+++ b/checks/cmciii
@@ -868,6 +868,9 @@ def reparse_cmciii_phase(parsed):
output.setdefault((unit, device, phase), {})
output[(unit, device, phase)][value_name] = value
+
+
+
return output
@@ -883,13 +886,17 @@ def check_cmciii_phase(item, params, parsed):
parsed = {}
parsed[item] = {}
- parsed[item]["voltage"] =
float(data['Voltage']['Value'].split()[0]), None
- parsed[item]["current"] =
float(data['Current']['Value'].split()[0]), None
- parsed[item]["power"] = float(data[('Power',
'Active')]['Value'].split()[0]), None
- parsed[item]["energy"] = float(data[('Energy',
'Active')]['Value'].split()[0]), None
+ for key, values in data.items():
+ if values.get("Value"):
+ if type(key) == tuple:
+ phase_key = key[0].lower()
+ else:
+ phase_key = key.lower()
+ parsed[item][phase_key] = float(data[key]['Value'].split()[0]), None
return check_elphase(item, params, parsed)
+
check_info['cmciii.phase'] = {
"check_function" : check_cmciii_phase,
"inventory_function" : inventory_cmciii_phase,