Module: check_mk
Branch: master
Commit: 9e7aac13831191b77722eb6244b5e74d6155e602
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9e7aac13831191…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Wed Jan 20 14:32:01 2016 +0100
openhardwaremonitor: fixes to item naming and crash on missing levels
---
checks/openhardwaremonitor | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/checks/openhardwaremonitor b/checks/openhardwaremonitor
index df73641..d64d411 100644
--- a/checks/openhardwaremonitor
+++ b/checks/openhardwaremonitor
@@ -80,8 +80,8 @@ def parse_openhardwaremonitor(info):
# header line
continue
parent = dict_replace(parent, {"intelcpu": "cpu",
"amdcpu": "cpu", "genericcpu": "cpu"})
- name = dict_replace(name, {"CPU ": ""})
- full_name = parent.replace("/", "") + " " + name
+ name = dict_replace(name, {"CPU ": "",
"Temperature": ""})
+ full_name = (parent.replace("/", "") + " " +
name).strip()
result.setdefault(sensor_type, {})[full_name] = float(value)
return result
@@ -120,8 +120,14 @@ def check_openhardwaremonitor(sensor_type, item, params, parsed):
if item in parsed.get(sensor_type, {}):
traits = type_trait(sensor_type)
val = parsed[sensor_type][item] * traits['factor']
- status_lower = expect_order(params['lower'][1],
params['lower'][0], val)
- status_upper = expect_order(val, params['upper'][0],
params['upper'][1])
+ if 'lower' in params:
+ status_lower = expect_order(params['lower'][1],
params['lower'][0], val)
+ else:
+ status_lower = 0
+ if 'upper' in params:
+ status_upper = expect_order(val, params['upper'][0],
params['upper'][1])
+ else:
+ status_upper = 0
perfdata = []
if 'perf_var' in traits:
perfdata = [(traits['perf_var'], val)]