aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Mágr <mmagr@redhat.com>2017-10-03 10:43:23 +0200
committerMartin Mágr <mmagr@redhat.com>2017-10-09 14:28:35 +0200
commitb56bad29fd7aec5262ea9250711a2d3a30bc203d (patch)
treeed08d704357d7e803e4ca389772f20d491eb2a21
parent6fea40f786a466802503c03b2b815d05676e1807 (diff)
List all unhealthy containers
Currently the default Sensu check defined in docker/services/sensu-client.yaml reports only first unhealthy container. This patch changes the check output to contain list of all unhealthy containers. Change-Id: I0a934367ef22984d9091d160ec7105092edc8149 Closes-Bug: #1720972 (cherry picked from commit 9b016c9f3fbe9552497737974b9928d1dff4d299)
-rw-r--r--docker/services/sensu-client.yaml6
1 files changed, 5 insertions, 1 deletions
diff --git a/docker/services/sensu-client.yaml b/docker/services/sensu-client.yaml
index b64231cd..a535af46 100644
--- a/docker/services/sensu-client.yaml
+++ b/docker/services/sensu-client.yaml
@@ -39,13 +39,17 @@ parameters:
SensuDockerCheckCommand:
type: string
default: |
+ output=''
for i in $(docker ps --format '{{.ID}}'); do
if result=$(docker inspect --format='{{.State.Health.Status}}' $i 2>/dev/null); then
if [ "$result" != 'healthy' ]; then
- echo "$(docker inspect --format='{{.Name}}' $i) ($i): $(docker inspect --format='{{json .State}}' $i)" && exit 2;
+ output="${output} ; $(docker inspect --format='{{.Name}}' $i) ($i): $(docker inspect --format='{{(index .State.Health.Log 0).Output}}' $i)";
fi
fi
done
+ if [ ! -z "${output}" ]; then
+ echo ${output:3} && exit 2;
+ fi
SensuDockerCheckInterval:
type: number
description: The frequency in seconds the docker health check is executed.