From d3e24e1085cc303fee8de1e292c94eaf972d516e Mon Sep 17 00:00:00 2001 From: Yu-Ju Hong Date: Wed, 15 Feb 2017 17:30:42 -0800 Subject: [PATCH] Fix the output of health-mointor.sh The script show prints the errors/response of the health check, but not show the progress of `curl`. --- cluster/gce/container-linux/health-monitor.sh | 6 ++++-- cluster/gce/gci/health-monitor.sh | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cluster/gce/container-linux/health-monitor.sh b/cluster/gce/container-linux/health-monitor.sh index c26ce288c38b0..6e8f1b03b1256 100644 --- a/cluster/gce/container-linux/health-monitor.sh +++ b/cluster/gce/container-linux/health-monitor.sh @@ -42,10 +42,12 @@ function kubelet_monitoring { # TODO(andyzheng0831): replace it with a more reliable method if possible. sleep 120 local -r max_seconds=10 + local output="" while [ 1 ]; do - if ! curl --insecure -m "${max_seconds}" -f -s https://127.0.0.1:${KUBELET_PORT:-10250}/healthz > /dev/null; then + if ! output=$(curl --insecure -m "${max_seconds}" -f -s -S https://127.0.0.1:${KUBELET_PORT:-10250}/healthz 2>&1); then + # Print the response and/or errors. + echo $output echo "Kubelet is unhealthy!" - curl --insecure https://127.0.0.1:${KUBELET_PORT:-10250}/healthz pkill kubelet # Wait for a while, as we don't want to kill it again before it is really up. sleep 60 diff --git a/cluster/gce/gci/health-monitor.sh b/cluster/gce/gci/health-monitor.sh index 32a4d6c9efc9f..c66d417331762 100644 --- a/cluster/gce/gci/health-monitor.sh +++ b/cluster/gce/gci/health-monitor.sh @@ -42,10 +42,12 @@ function kubelet_monitoring { # TODO(andyzheng0831): replace it with a more reliable method if possible. sleep 120 local -r max_seconds=10 + local output="" while [ 1 ]; do - if ! curl -m "${max_seconds}" -f -s http://127.0.0.1:10255/healthz > /dev/null; then + if ! output=$(curl -m "${max_seconds}" -f -s -S http://127.0.0.1:10255/healthz 2>&1); then + # Print the response and/or errors. + echo $output echo "Kubelet is unhealthy!" - curl http://127.0.0.1:10255/healthz pkill kubelet # Wait for a while, as we don't want to kill it again before it is really up. sleep 60