Module: check_mk
Branch: master
Commit: 9cc4b29ee674db67ec727e43206e387e8301c6a6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9cc4b29ee674db…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Jan 11 11:55:01 2017 +0100
4287 FIX job: fixed incomplete data handling
KeyError occurs if data of job is incomplete, eg. exit code is missing.
Change-Id: I87826d10298d8f02100dbd5c5e14802f2e4920b8
---
.werks/4287 | 10 ++++++++++
ChangeLog | 1 +
checks/job | 3 +++
3 files changed, 14 insertions(+)
diff --git a/.werks/4287 b/.werks/4287
new file mode 100644
index 0000000..2e141d4
--- /dev/null
+++ b/.werks/4287
@@ -0,0 +1,10 @@
+Title: job: fixed incomplete data handling
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i4
+Date: 1484131919
+
+KeyError occurs if data of job is incomplete, eg. exit code is missing.
diff --git a/ChangeLog b/ChangeLog
index 3027fe9..71264a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -38,6 +38,7 @@
* 4211 FIX: esx_vsphere_counters: No longer crash when counters are available for
instances without a read value
* 4265 FIX: netapp_api_cpu: fixed missing number of cpus
* 4266 FIX: quantum_libsmall_status: fixed scan function
+ * 4287 FIX: job: fixed incomplete data handling...
Multisite:
* 4169 View action: Default values of sticky, notification and persistent options can
now be configured via global settings....
diff --git a/checks/job b/checks/job
index d9213dc..091304c 100644
--- a/checks/job
+++ b/checks/job
@@ -113,6 +113,9 @@ def check_job(item, params, info):
if not job:
return 3, 'Got no information for this job'
+ if job.get("exit_code") is None:
+ return 3, 'Got incomplete information for this job'
+
def process_start_time(value, state, warn, crit):
display_value = time.strftime("%Y-%m-%d %H:%M:%S",
time.localtime(value) )
job_age = time.time() - value