print container logs when not healthy
Change-Id: I826cab4eb2e79ee89ecf633361009fb2ad5d0d05
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
diff --git a/installers/osm_health.sh b/installers/osm_health.sh
index 2be8ce4..4625dc8 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 @@
n)
NUM_SERVICES_WITH_HEALTH=${OPTARG}
;;
+ c)
+ SERVICES_WITH_HEALTH="${OPTARG}"
+ ;;
esac
done
@@ -32,4 +36,14 @@
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
+