Module: check_mk
Branch: master
Commit: 8d0757f6d37d86b42669b0ce371edc4f9cd0b13a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8d0757f6d37d86…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Feb 16 09:21:19 2016 +0100
#3212 FIX cmciii.phase: Fixed totally broken check
---
.werks/3212 | 10 ++++++++++
ChangeLog | 1 +
checks/cmciii | 26 +++++++++++++++++---------
3 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/.werks/3212 b/.werks/3212
new file mode 100644
index 0000000..e589e23
--- /dev/null
+++ b/.werks/3212
@@ -0,0 +1,10 @@
+Title: cmciii.phase: Fixed totally broken check
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1455610863
+
+
diff --git a/ChangeLog b/ChangeLog
index af1b2cd..e57b07f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,7 @@
* 3209 FIX: esx_vsphere_datastores: Added missing uncommitted and overprovisioned
graphs
* 3210 FIX: oracle_asm_diskgroup: Fixed exception when using required mirror free
space parameter
* 3211 FIX: logwatch: Fixed broken error messages in case of failed filesystem
operations
+ * 3212 FIX: cmciii.phase: Fixed totally broken check
Multisite:
* 3059 FIX: Fixed highlighting of availability timeline time slices
diff --git a/checks/cmciii b/checks/cmciii
index 468f125..ca0e2d1 100644
--- a/checks/cmciii
+++ b/checks/cmciii
@@ -851,19 +851,28 @@ def reparse_cmciii_phase(parsed):
output = {}
for name, value in inputs.items():
if name[1].find("Phase") != -1:
- device, phase, value_name = name[1].split('.')
- unit_id = int( name[0])
- unit = units[unit_id-1][1]
- phase = phase[-1]
+ parts = name[1].split('.')
+ if len(parts) == 3:
+ device, phase, value_name = parts
+ else:
+ device, phase, value_name, value_name_add = parts
+ value_name = (value_name, value_name_add)
+
+ unit_id = int(name[0])
+ unit = units[unit_id-1][1]
+ phase = phase[-1]
+
output.setdefault((unit, device, phase), {})
output[(unit, device, phase)][value_name] = value
return output
+
def inventory_cmciii_phase(parsed):
parsed = reparse_cmciii_phase(parsed)
- for (device, unit, phase), values in parsed.items():
+ for device, unit, phase in parsed.keys():
yield "%s %s Phase %s" % (device, unit, phase), {}
+
def check_cmciii_phase(item, params, parsed):
device, unit, word, phase = item.split()
data = reparse_cmciii_phase(parsed)[(device, unit, phase)]
@@ -872,11 +881,10 @@ def check_cmciii_phase(item, params, 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']['Value'].split()[0]), None
- #parsed[item]["appower"] =
float(data['Current']['Value'].split()[0]), None
- parsed[item]["energy"] =
float(data['Energy']['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
- return check_elphase(item, params, unit_items)
+ return check_elphase(item, params, parsed)
check_info['cmciii.phase'] = {
"check_function" : check_cmciii_phase,