Module: check_mk
Branch: master
Commit: ee72f0baac0c00df9a63f9e3f63ba6cbd13d9823
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ee72f0baac0c00…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue May 22 14:59:03 2018 +0200
6150 FIX docker_container_status: Fix crash when receiving data from multiple hosts
Change-Id: I75e20a53769a7b0f420671d979e711bed68c1ae5
---
.werks/6150 | 11 +++++++++++
checks/docker_container_status | 12 ++++++++++--
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/.werks/6150 b/.werks/6150
new file mode 100644
index 0000000..b31a42f
--- /dev/null
+++ b/.werks/6150
@@ -0,0 +1,11 @@
+Title: docker_container_status: Fix crash when receiving data from multiple hosts
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1526993923
+
+
diff --git a/checks/docker_container_status b/checks/docker_container_status
index f1cb43d..09e47e4 100644
--- a/checks/docker_container_status
+++ b/checks/docker_container_status
@@ -28,9 +28,17 @@
def parse_docker_container_status(info):
+ if not info:
+ return
+
+ # In case there are multiple lines of output sent by the agent only process the
first
+ # line. We assume that this a full JSON object. The rest of the section is skipped.
+ # When a container got piggyback data from multiple hosts (e.g. a cluster) this
results
+ # in multiple JSON objects handed over to this check.
+ json_raw_data = info[0]
+
import json
- json_data = "\n".join(" ".join(line) for line in info)
- return json.loads(json_data)
+ return json.loads(json_raw_data)
#.