Created
June 18, 2025 17:18
-
-
Save regispires/6922c0eea6e7ab2f12ad939c772ed0f1 to your computer and use it in GitHub Desktop.
k8s-problematic-nodes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "=== NÓS COM PROBLEMAS EM TODOS OS CLUSTERS ===" | |
echo "Data: $(date)" | |
echo "" | |
total_problematic=0 | |
for context in $(kubectl config get-contexts -o name); do | |
echo "========================================" | |
echo "CLUSTER: $context" | |
echo "========================================" | |
if kubectl --context=$context cluster-info &>/dev/null; then | |
# Buscar nós com problemas | |
problematic_nodes=$(kubectl --context=$context get nodes --no-headers | grep -v " Ready ") | |
if [ ! -z "$problematic_nodes" ]; then | |
echo "❌ NÓS COM PROBLEMAS:" | |
echo "$problematic_nodes" | |
count=$(echo "$problematic_nodes" | wc -l) | |
total_problematic=$((total_problematic + count)) | |
else | |
echo "✅ Todos os nós estão funcionando normalmente" | |
fi | |
else | |
echo "❌ Cluster inacessível" | |
fi | |
echo "" | |
done | |
echo "========================================" | |
echo "RESUMO" | |
echo "========================================" | |
echo "Total de nós com problemas: $total_problematic" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment