Module: check_mk
Branch: master
Commit: 1957a9c60a47c30f6a5f36804b85faed7e3059b1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1957a9c60a47c3…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Jan 11 09:53:49 2017 +0100
4262 FIX wmi_cpuload: fixed missing section handling
If computer system section is missing then we assume that there's one core.
Change-Id: I93cf853db62501ff763a09a10b793ea61b3e09d8
---
.werks/4262 | 10 ++++++++++
ChangeLog | 1 +
checks/wmi_cpuload | 11 ++++++++---
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/.werks/4262 b/.werks/4262
new file mode 100644
index 0000000..50dae10
--- /dev/null
+++ b/.werks/4262
@@ -0,0 +1,10 @@
+Title: wmi_cpuload: fixed missing section handling
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i4
+Date: 1484124769
+
+If computer system section is missing then we assume that there's one core.
diff --git a/ChangeLog b/ChangeLog
index d5516be..1263aa1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,6 +32,7 @@
* 4232 FIX: tsm_storagepools: Fixed missing perfdata
* 4259 FIX: aix_sap_processlist: fixed ValueError; if process has stopped and does
not report any start time
* 4261 FIX: db2_logsizes: fixed wrong discovery condition
+ * 4262 FIX: wmi_cpuload: fixed missing section handling...
Multisite:
* 4169 View action: Default values of sticky, notification and persistent options can
now be configured via global settings....
diff --git a/checks/wmi_cpuload b/checks/wmi_cpuload
index 543b60d..94ef88d 100644
--- a/checks/wmi_cpuload
+++ b/checks/wmi_cpuload
@@ -37,10 +37,15 @@ def check_wmi_cpuload(item, params, parsed):
load15min = get_average("load_15min", this_time, load, 15)
try:
- cores = int(parsed["computer_system"].get(0,
"NumberOfLogicalProcessors"))
- except (ValueError, KeyError), e:
+ computer_system = parsed["computer_system"]
+ except KeyError:
+ computer_system = {}
+
+ try:
+ cores = int(computer_system.get(0, "NumberOfLogicalProcessors"))
+ except ValueError:
# NumberOfLogicalProcessors can be an empty string, not sure why
- cores = int(parsed["computer_system"].get(0,
"NumberOfProcessors"))
+ cores = 1
return check_cpu_load_generic(params, (load, load5min, load15min), cores)