diff options
| -rwxr-xr-x | service/check_kaas.sh | 16 | 
1 files 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"  | 
