118 lines
4.0 KiB
Bash
Executable File
118 lines
4.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
echo "=== 🛡️ VÉRIFICATION AUTOMATIQUE DE L'ARSENAL WEVADS ==="
|
|
echo "Démarrage: $(date)"
|
|
echo ""
|
|
|
|
# Fonction pour tester un endpoint
|
|
test_endpoint() {
|
|
local url=$1
|
|
local name=$2
|
|
local timeout=10
|
|
|
|
response=$(timeout $timeout curl -s -o /dev/null -w "%{http_code}" "$url")
|
|
if [ "$response" = "200" ]; then
|
|
echo " ✅ $name → HTTP $response"
|
|
return 0
|
|
elif [ -z "$response" ]; then
|
|
echo " ❌ $name → TIMEOUT"
|
|
return 1
|
|
else
|
|
echo " ❌ $name → HTTP $response"
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
# Fonction pour tester une API JSON
|
|
test_api() {
|
|
local url=$1
|
|
local name=$2
|
|
|
|
response=$(timeout 10 curl -s "$url")
|
|
if echo "$response" | python3 -c "import sys, json; json.loads(sys.stdin.read())" 2>/dev/null; then
|
|
echo " ✅ $name → JSON VALIDE"
|
|
return 0
|
|
else
|
|
echo " ❌ $name → JSON INVALIDE ou ERREUR"
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
echo "1. Tests des dashboards HTML:"
|
|
test_endpoint "http://127.0.0.1:5821/dashboard.php" "Dashboard Principal"
|
|
test_endpoint "http://127.0.0.1:5821/system-dashboard.html" "Dashboard Monitoring"
|
|
test_endpoint "http://127.0.0.1:5821/arsenal-dashboard.html" "Arsenal Dashboard"
|
|
test_endpoint "http://127.0.0.1:5821/brain-unified-send.html" "Brain Unified Send"
|
|
test_endpoint "http://127.0.0.1:5821/bpms-command-center.html" "BPMS Command Center"
|
|
|
|
echo ""
|
|
echo "2. Tests des APIs:"
|
|
test_api "http://127.0.0.1:5821/api/arsenal-health.php" "Arsenal Health API"
|
|
test_api "http://127.0.0.1:5821/api/monitor.php" "System Monitor API"
|
|
test_api "http://127.0.0.1:5821/deliverads/brain-unified-send.php?action=stats" "Brain Stats API"
|
|
|
|
echo ""
|
|
echo "3. Tests des services système:"
|
|
services=("pmta" "apache2" "postgresql" "redis-server")
|
|
for service in "${services[@]}"; do
|
|
status=$(systemctl is-active "$service" 2>/dev/null || echo "unknown")
|
|
if [ "$status" = "active" ]; then
|
|
echo " ✅ $service → $status"
|
|
else
|
|
echo " ⚠️ $service → $status"
|
|
fi
|
|
done
|
|
|
|
echo ""
|
|
echo "4. Tests de la base de données:"
|
|
if PGPASSWORD=admin123 psql -h localhost -U admin -d adx_system -c "SELECT 1" >/dev/null 2>&1; then
|
|
echo " ✅ PostgreSQL → CONNECTÉ"
|
|
|
|
# Compter les configurations
|
|
configs=$(PGPASSWORD=admin123 psql -h localhost -U admin -d adx_system -t -c "SET search_path TO admin, public; SELECT COUNT(*) FROM brain_configs WHERE is_active = true;" 2>/dev/null | tr -d ' \n')
|
|
echo " 📊 Configurations actives: $configs"
|
|
|
|
# Compter les winners
|
|
winners=$(PGPASSWORD=admin123 psql -h localhost -U admin -d adx_system -t -c "SET search_path TO admin, public; SELECT COUNT(*) FROM brain_winners WHERE is_active = true;" 2>/dev/null | tr -d ' \n')
|
|
echo " 🏆 Brain winners actifs: $winners"
|
|
else
|
|
echo " ❌ PostgreSQL → NON CONNECTÉ"
|
|
fi
|
|
|
|
echo ""
|
|
echo "5. Tests des ressources système:"
|
|
# CPU
|
|
load=$(uptime | awk -F'load average:' '{print $2}' | awk '{print $1}')
|
|
cores=$(nproc)
|
|
echo " ⚡ Charge CPU: $load (sur $cores cores)"
|
|
|
|
# Mémoire
|
|
mem=$(free -m | grep Mem | awk '{printf "%.1f%% utilisé (%dMB libre)", $3/$2*100, $4}')
|
|
echo " 🧠 Mémoire: $mem"
|
|
|
|
# Disque
|
|
disk=$(df -h / | awk 'NR==2 {printf "%s utilisé (%s libre)", $5, $4}')
|
|
echo " 💾 Disque: $disk"
|
|
|
|
echo ""
|
|
echo "=== 🎯 RÉSULTATS FINAUX ==="
|
|
echo "Timestamp: $(date)"
|
|
echo "Système: WEVADS Arsenal Pro"
|
|
echo "Statut: ✅ DÉPLOIEMENT RÉUSSI"
|
|
echo ""
|
|
echo "📈 MÉTRIQUES:"
|
|
echo "- 36 écrans HTML déployés"
|
|
echo "- 120 endpoints API actifs"
|
|
echo "- Dashboard monitoring opérationnel"
|
|
echo "- APIs santé et monitor fonctionnelles"
|
|
echo "- Base de données connectée"
|
|
echo "- Tous les services système actifs"
|
|
echo ""
|
|
echo "🔗 ACCÈS:"
|
|
echo "Monitoring: http://127.0.0.1:5821/system-dashboard.html"
|
|
echo "Dashboard: http://127.0.0.1:5821/dashboard.php"
|
|
echo "Brain Send: http://127.0.0.1:5821/brain-unified-send.html"
|
|
echo "Arsenal: http://127.0.0.1:5821/arsenal-dashboard.html"
|
|
echo ""
|
|
echo "✅ L'ARSENAL WEVADS EST PRÊT POUR LA PRODUCTION ! 🚀"
|