From: tierno Date: Thu, 11 Oct 2018 13:03:06 +0000 (+0200) Subject: print container logs when not healthy X-Git-Tag: v5.0.0~80 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=bc983ec9d4dd2ffed3c593516679f57c68954821;p=osm%2Fdevops.git print container logs when not healthy Change-Id: I826cab4eb2e79ee89ecf633361009fb2ad5d0d05 Signed-off-by: tierno --- diff --git a/installers/osm_health.sh b/installers/osm_health.sh index 2be8ce4f..4625dc80 100755 --- a/installers/osm_health.sh +++ b/installers/osm_health.sh @@ -2,8 +2,9 @@ WAIT_TIME=60 NUM_SERVICES_WITH_HEALTH=3 +SERVICES_WITH_HEALTH="nbi ro kafka" -while getopts "w:s:n:" o; do +while getopts "w:s:n:c:" o; do case "${o}" in w) WAIT_TIME=${OPTARG} @@ -14,6 +15,9 @@ while getopts "w:s:n:" o; do n) NUM_SERVICES_WITH_HEALTH=${OPTARG} ;; + c) + SERVICES_WITH_HEALTH="${OPTARG}" + ;; esac done @@ -32,4 +36,14 @@ done echo "Not all Docker services are healthy" docker ps | grep " ${STACK_NAME}_" +for S_WITH_HEALTH in $SERVICES_WITH_HEALTH ; do + docker ps | grep " ${STACK_NAME}_" | grep -i healthy | grep -q "_${S_WITH_HEALTH}." && continue + echo + echo BEGIN LOGS of container ${S_WITH_HEALTH} not healthy + docker service logs ${STACK_NAME}_${S_WITH_HEALTH} 2>&1 | tail -n 100 + echo END LOGS of container ${S_WITH_HEALTH} not healthy + echo +done + exit 1 +