Module: check_mk
Branch: master
Commit: dcd718a8cab3905bd3d54f3bd77a24b00db895ac
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dcd718a8cab390…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon May 28 21:38:18 2018 +0200
Improved performance of gathering docker container specific information from the node
Change-Id: I8aa9ae619f2f6e3693e379dcc0abdc7a6a1a1bdf
---
agents/check_mk_agent.linux | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 506e198..530ecfb 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -1019,18 +1019,8 @@ if type docker > /dev/null 2>&1 && [ -z
"$MK_IS_PIGGYBACKED" ]; then
# For the container status, we want information about *all* containers
for CONTAINER_ID in $(docker container ls -q --all); do
echo "<<<<${CONTAINER_ID}>>>>"
- echo "<<<docker_container_status>>>"
- docker inspect "$CONTAINER_ID" --format='{{json .State}}'
-
- echo "<<<docker_container_node_name>>>"
- echo "$NODE_NAME"
-
- echo "<<<docker_container_labels>>>"
- docker inspect "$CONTAINER_ID" --format='{{json
.Config.Labels}}'
-
- echo "<<<docker_container_network>>>"
- docker inspect "$CONTAINER_ID" --format='{{json
.NetworkSettings}}'
-
+ docker inspect "$CONTAINER_ID" \
+ --format='{{println
"<<<docker_container_status>>>"}}{{json
.State}}{{println}}{{println
"<<<docker_container_node_name>>>"}}{{println
'"$NODE_NAME"'}}{{println
"<<<docker_container_labels>>>"}}{{json
.Config.Labels}}{{println}}{{println
"<<<docker_container_network>>>"}}{{json
.NetworkSettings}}{{println}}'
echo "<<<<>>>>"
done