From 4bc60db4b1db1c71ea17141ca7dfbcc5faf32227 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Thu, 10 Jan 2019 06:35:46 +0100 Subject: Don't complain on just normally errornous pods --- service/check_kaas.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/service/check_kaas.sh b/service/check_kaas.sh index e69e73d..b43acc0 100755 --- a/service/check_kaas.sh +++ b/service/check_kaas.sh @@ -36,13 +36,13 @@ if [ $healthy -ne 0 ]; then fi fi -# Find pods in wrong states +# Find pods in unexpected states if [ $healthy -ne 0 ]; then - pods=$(oc get pods --all-namespaces | awk '$6~/s|m/ { next } { print }' | grep -P "Terminating|Pending|CrashLoopBackOff" | wc -l) + pods=$(oc get pods --all-namespaces | awk '$6~/s|m/ { next } { print }' | grep -P "Terminating|Pending" | wc -l) if [ $pods -ge $e_pods ]; then healthy=2 echo "Pods stalled in wrong states:" - oc get pods --all-namespaces -o wide | awk '$6~/s|m/ { next } { print }' | grep -P "(Terminating|Pending|CrashLoopBackOff)" | head -n $p_pods | sed -e 's/[[:space:]]\+/ /g' + oc get pods --all-namespaces -o wide | awk '$6~/s|m/ { next } { print }' | grep -P "(Terminating|Pending)" | head -n $p_pods | sed -e 's/[[:space:]]\+/ /g' fi fi @@ -56,4 +56,14 @@ if [ $healthy -ne 0 ]; then fi fi +# Find own pods in error states +if [ $healthy -ne 0 ]; then + pods=$(oc get pods --all-namespaces | grep -P "adei|adai|bora" | awk '$6~/s|m/ { next } { print }' | grep -P "CrashLoopBackOff|Error" | wc -l) + if [ $pods -ge $e_pods ]; then + healthy=2 + echo "Pods with errors:" + oc get pods --all-namespaces -o wide | grep -P "adei|adai|bora" | awk '$6~/s|m/ { next } { print }' | grep -P "(CrashLoopBackOff|Error)" | head -n $p_pods | sed -e 's/[[:space:]]\+/ /g' + fi +fi + echo "$online $healthy $version $nodes" -- cgit v1.2.1