diff options
-rw-r--r-- | docker/services/sensu-client.yaml | 6 |
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. |