Module: check_mk
Branch: master
Commit: 7e590440fbee2ff9dd801472396124e76f3dc545
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7e590440fbee2f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Sun Apr 29 19:57:00 2018 +0200
6048 FIX docker_node_info.containers: Fixed crash when daemon is not running
Change-Id: I9dd77ed81583aa207cbb78ee52b2d4346e14a32d
---
.werks/6048 | 11 +++++++++++
checks/docker_node_info | 9 +++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/.werks/6048 b/.werks/6048
new file mode 100644
index 0000000..9deab75
--- /dev/null
+++ b/.werks/6048
@@ -0,0 +1,11 @@
+Title: docker_node_info.containers: Fixed crash when daemon is not running
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1525024595
+
+
diff --git a/checks/docker_node_info b/checks/docker_node_info
index 5f72551..7a2cd36 100644
--- a/checks/docker_node_info
+++ b/checks/docker_node_info
@@ -34,7 +34,7 @@ def parse_docker_node_info(info):
def inventory_docker_node_info(parsed):
- if parsed:
+ if parsed and isinstance(parsed, dict):
return [(None, {})]
@@ -55,10 +55,15 @@ check_info['docker_node_info'] = {
def inventory_docker_node_containers(parsed):
- return [(None, {})]
+ if parsed and isinstance(parsed, dict):
+ return [(None, {})]
def check_docker_node_containers(item, params, parsed):
+ if not isinstance(parsed, dict):
+ # String with error message in case the daemon is not running
+ return
+
def check_node_levels(count, warn, crit, warn_lower, crit_lower):
if crit is not None and count >= crit:
return 2, " (warn/crit at %s/%s)" % (warn, crit)