Module: check_mk
Branch: master
Commit: 71522df8b28406acc1d9f0a08c966a68b9780fe6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=71522df8b28406…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Feb 10 15:11:21 2015 +0100
#1940 FIX ps: Fixed a rare crash on malformed agent output
Sometimes the windows agent reported process lines without a process name, like<br>
<tt>(\\ZAOE\Grotest,149572,25184,0,20348,7752,7656250,12500000,241,5)</tt><br>
The ps check crashed because it couldn't handle this type of line
---
.werks/1940 | 12 ++++++++++++
ChangeLog | 1 +
checks/ps | 4 ++++
3 files changed, 17 insertions(+)
diff --git a/.werks/1940 b/.werks/1940
new file mode 100644
index 0000000..8d132e1
--- /dev/null
+++ b/.werks/1940
@@ -0,0 +1,12 @@
+Title: ps: Fixed a rare crash on malformed agent output
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1423577273
+Class: fix
+
+Sometimes the windows agent reported process lines without a process name,
like<br>
+<tt>(\\ZAOE\Grotest,149572,25184,0,20348,7752,7656250,12500000,241,5)</tt><br>
+The ps check crashed because it couldn't handle this type of line
+
diff --git a/ChangeLog b/ChangeLog
index a74b053..1d7b278 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -155,6 +155,7 @@
* 1960 FIX: akcp_sensor_drycontact: Service description prefix changed from
"Device" to "Dry Contact"...
NOTE: Please refer to the migration notes!
* 1938 FIX: docsis_channels_upstream: fixed missing checks if channels had the same
ChannelId...
+ * 1940 FIX: ps: Fixed a rare crash on malformed agent output...
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request,
added mailto link for error report...
diff --git a/checks/ps b/checks/ps
index 091f7bf..2e20cbd 100644
--- a/checks/ps
+++ b/checks/ps
@@ -102,6 +102,10 @@ def ps_parse_info(info):
use_wmic_info = False
if not use_wmic_info:
# We need to determine the number of cpu_cores without the wmic_info
+ if len(line) < 3:
+ # On some rare instances the name of the process is missing
+ # This line will be igored
+ continue
if line[2].lower() == "system idle process":
cpu_cores = int(line[1][1:-1].split(",")[9])
ps_result.append(line)