93 lines
3.1 KiB
Bash
Executable File
93 lines
3.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Script de vérification rapide de l'état du système LeCoffre Node
|
|
|
|
set -e
|
|
|
|
# Couleurs
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
CYAN='\033[0;36m'
|
|
NC='\033[0m'
|
|
|
|
echo -e "${CYAN}========================================${NC}"
|
|
echo -e "${CYAN} LeCoffre Node - Quick Health Check${NC}"
|
|
echo -e "${CYAN}========================================${NC}"
|
|
|
|
# Fonction pour tester une URL
|
|
test_url() {
|
|
local url="$1"
|
|
local description="$2"
|
|
local expected_codes="${3:-200}"
|
|
|
|
local response=$(curl -s -o /dev/null -w '%{http_code}' --max-time 5 "$url" 2>/dev/null || echo "000")
|
|
|
|
# Support multiple acceptable codes
|
|
local ok=false
|
|
IFS=',' read -r -a expected_array <<< "$expected_codes"
|
|
for code in "${expected_array[@]}"; do
|
|
if [ "$response" = "$code" ]; then
|
|
ok=true
|
|
break
|
|
fi
|
|
done
|
|
|
|
if [ "$ok" = true ]; then
|
|
echo -e " ${GREEN}✓${NC} $description: HTTP $response"
|
|
return 0
|
|
else
|
|
echo -e " ${RED}✗${NC} $description: HTTP $response"
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
# Vérification des services Docker
|
|
echo -e "\n${BLUE}=== Services Docker ===${NC}"
|
|
docker ps --format "table {{.Names}}\t{{.Status}}" | grep -E "(tor-proxy|bitcoin-signet|blindbit-oracle|sdk_storage|sdk_relay|lecoffre-front|ihm_client|grafana|loki|promtail|status-api)"
|
|
|
|
# Tests URLs internes critiques
|
|
echo -e "\n${BLUE}=== URLs Internes Critiques ===${NC}"
|
|
test_url "http://localhost:8000/tweaks/1" "BlindBit Oracle API" "200"
|
|
test_url "http://localhost:8081/health" "SDK Storage Health" "200"
|
|
test_url "http://localhost:8091/" "SDK Relay Health" "200"
|
|
test_url "http://localhost:3004/" "LeCoffre Frontend" "200"
|
|
test_url "http://localhost:3003/" "IHM Client" "200"
|
|
test_url "http://localhost:3005/api/health" "Grafana Health" "200"
|
|
|
|
# Tests URLs publiques
|
|
echo -e "\n${BLUE}=== URLs Publiques ===${NC}"
|
|
test_url "https://dev4.4nkweb.com/" "Site Principal" "200"
|
|
test_url "https://dev4.4nkweb.com/status/" "Page de Statut" "200"
|
|
test_url "https://dev4.4nkweb.com/grafana/" "Grafana Dashboard" "200,302"
|
|
test_url "https://dev4.4nkweb.com/lecoffre" "Application LeCoffre" "200,301,302"
|
|
|
|
# Tests APIs externes
|
|
echo -e "\n${BLUE}=== APIs Externes ===${NC}"
|
|
test_url "https://dev3.4nkweb.com/api/v1/health" "API Backend Health" "200"
|
|
|
|
# Vérification de l'espace disque
|
|
echo -e "\n${BLUE}=== Espace Disque ===${NC}"
|
|
df -h / | awk 'NR==2 {printf " %s: %s utilisé (%s disponible)\n", $1, $5, $4}'
|
|
|
|
# Vérification de la mémoire
|
|
echo -e "\n${BLUE}=== Mémoire ===${NC}"
|
|
free -h | awk 'NR==2 {printf " Mémoire: %s/%s utilisé (%.1f%%)\n", $3, $2, ($3/$2)*100}'
|
|
|
|
# Vérification des volumes Docker
|
|
echo -e "\n${BLUE}=== Volumes Docker ===${NC}"
|
|
docker volume ls | grep "4nk_node_" | while read -r volume; do
|
|
vol_name=$(echo "$volume" | awk '{print $2}')
|
|
vol_size=$(docker system df -v | grep "$vol_name" | awk '{print $3}' || echo "N/A")
|
|
echo -e " ${GREEN}✓${NC} $vol_name: $vol_size"
|
|
done
|
|
|
|
echo -e "\n${CYAN}========================================${NC}"
|
|
echo -e "${GREEN}✓ Vérification rapide terminée${NC}"
|
|
echo -e "${CYAN}========================================${NC}"
|
|
|
|
|
|
|
|
|
|
|