Module: check_mk
Branch: master
Commit: f3eec1e2acfba3faa8ba966c5dfb4196454bee87
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f3eec1e2acfba3…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Mon Apr 1 10:59:30 2019 +0200
7386 FIX docker_node_disk_usage: Handle busy docker daemon
If the docker daemon cannot get the disk usage info, the corresponding services
will become stale without the Check_MK Discovery service going into a WARNING
state.
This can happen if you are calling the mk_docker plugin from different Sites.
Consider configuring asynchronous plugin execution in this case.
CMK-1786
Change-Id: Ic869f486e1a3a63efd607d8dc4254638596128b3
---
.werks/7386 | 14 ++++++++++++++
agents/plugins/mk_docker.py | 9 +++++++--
tests/unit/plugins/test_mk_docker.py | 2 +-
3 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/.werks/7386 b/.werks/7386
new file mode 100644
index 0000000..6fa4e7e
--- /dev/null
+++ b/.werks/7386
@@ -0,0 +1,14 @@
+Title: docker_node_disk_usage: Handle busy docker daemon
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1554108850
+Class: fix
+
+If the docker daemon cannot get the disk usage info, the corresponding services
+will become stale without the Check_MK Discovery service going into a WARNING
+state.
+This can happen if you are calling the mk_docker plugin from different Sites.
+Consider configuring asynchronous plugin execution in this case.
diff --git a/agents/plugins/mk_docker.py b/agents/plugins/mk_docker.py
index d533420..dbe424e 100755
--- a/agents/plugins/mk_docker.py
+++ b/agents/plugins/mk_docker.py
@@ -327,9 +327,14 @@ def section_node_info(client, _config):
@skippable
def section_node_disk_usage(client, _config):
'''docker system df'''
- data = client.df()
- LOGGER.debug(data)
section = Section('node_disk_usage')
+ try:
+ data = client.df()
+ except () if DEBUG else docker.errors.APIError as exc:
+ section.write()
+ LOGGER.exception(exc)
+ return
+ LOGGER.debug(data)
def get_row(type_, instances, is_inactive, key='Size'):
inactive = [i for i in instances if is_inactive(i)]
diff --git a/tests/unit/plugins/test_mk_docker.py b/tests/unit/plugins/test_mk_docker.py
index e53371a..f281791 100644
--- a/tests/unit/plugins/test_mk_docker.py
+++ b/tests/unit/plugins/test_mk_docker.py
@@ -11,7 +11,7 @@ sys.path.insert(0, os.path.join(cmk_path(), 'agents',
'plugins'))
import mk_docker # pylint: disable=import-error,wrong-import-position
PLUGIN_CHECKSUMS = {
- '0.1': 'f43bbe8ce8f19763d53ffa116988fa2d',
+ '0.1': 'c00f1771660172e8b1b9cc225c2930ab',
}