Module: check_mk
Branch: master
Commit: 305f3bd05867ec0984ce0d27055a86b3a2f471f9
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=305f3bd05867ec…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Apr 10 09:13:44 2019 +0200
openhardwaremonitor: Handles WMI timeouts
Change-Id: I1437c7a1df7aa52d9a4669a7770294eb1d711ae8
---
.werks/7366 | 13 +++++++++++++
checks/openhardwaremonitor | 9 +++++++++
2 files changed, 22 insertions(+)
diff --git a/.werks/7366 b/.werks/7366
new file mode 100644
index 0000000..72b3169
--- /dev/null
+++ b/.werks/7366
@@ -0,0 +1,13 @@
+Title: openhardwaremonitor: Handles WMI timeouts correctly
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1554899463
+Class: fix
+
+Newer Windows agents provide an additional column WMIStatus
+with the possible value OK or Timeout.
+In case of a WMI timeout the {{openhardwaremonitor}} services
+go stale.
diff --git a/checks/openhardwaremonitor b/checks/openhardwaremonitor
index ce20800..ef6b267 100644
--- a/checks/openhardwaremonitor
+++ b/checks/openhardwaremonitor
@@ -170,6 +170,7 @@ def inventory_openhardwaremonitor(sensor_type, parsed):
def check_openhardwaremonitor(sensor_type, item, params, parsed):
if item in parsed.get(sensor_type, {}):
data = parsed[sensor_type][item]
+ _check_openhardwaremonitor_wmistatus(data)
if 'lower' in params:
status_lower = _openhardwaremonitor_expect_order(params['lower'][1],
params['lower'][0],
data.reading)
@@ -189,6 +190,11 @@ def check_openhardwaremonitor(sensor_type, item, params, parsed):
'%.1f%s' % (data.reading, data.unit), perfdata)
+def _check_openhardwaremonitor_wmistatus(data):
+ if data.WMIstatus.lower() == 'timeout':
+ raise MKCounterWrapped('WMI query timed out')
+
+
# .--clock---------------------------------------------------------------.
# | _ _ |
# | ___| | ___ ___| | __ |
@@ -231,6 +237,7 @@ def check_openhardwaremonitor_temperature(item, params, parsed):
if item in parsed.get('Temperature', {}):
data = parsed['Temperature'][item]
+ _check_openhardwaremonitor_wmistatus(data)
return check_temperature(data.reading, params, "openhardwaremonitor_%s"
% item)
@@ -281,6 +288,7 @@ factory_settings['openhardwaremonitor_fan_default_levels'] =
{
def check_openhardwaremonitor_fan(item, params, parsed):
if item in parsed.get("Fan", {}):
data = parsed["Fan"][item]
+ _check_openhardwaremonitor_wmistatus(data)
return check_fan(data.reading, params)
@@ -338,6 +346,7 @@ def check_openhardwaremonitor_smart(item, params, parsed):
warn, crit = params[reading['key']]
data = parsed[sensor_type][reading_name]
+ _check_openhardwaremonitor_wmistatus(data)
if reading.get('lower_bounds', False):
status = _openhardwaremonitor_expect_order(crit, warn, data.reading)