-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpodschecker.sh
More file actions
executable file
·40 lines (37 loc) · 1005 Bytes
/
podschecker.sh
File metadata and controls
executable file
·40 lines (37 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# colores
blanc="\033[1;37m"
gray="\033[0;37m"
magento="\033[0;35m"
red="\033[1;31m"
green="\033[1;32m"
amarillo="\033[1;33m"
azul="\033[1;34m"
rescolor="\e[0m"
listPods=$(kubectl get po | awk 'NR>1{print $1}')
#echo "$listPods"
readarray arr <<< $listPods
ok=0
notok=0
echo -e "\nSit Down and Wait \U1F602 :\n"
for i in ${arr[@]}
do
echo -ne "$i ... "
status=$(kubectl get po $i | grep $i | awk '{print $3}')
if [[ ! $status =~ ^Running$|^Completed$ ]] ; then
echo -e "\e[1;31mOh Shit !"$rescolor""
notify-send "Pods Health" "$i was FUCKED" -t 10000
let notok=notok+1
else
echo -e "\e[1;32mOK!"$rescolor""
#notify-send "Pod $i Is Good :)"
let ok=ok+1
fi
done
echo -e "\nSTATS:\n"
echo "+---------------+---------------+"
printf "|$green%-15s$rescolor|$red%-15s$rescolor|\n" "Healthy Pods" "Unhealthy Pods"
echo "+---------------+---------------+"
printf "|%-15s|%-15s|\n" "$ok" "$notok"
echo "+---------------+---------------+"
echo -e "\n"