Files
weval-l99/proactive-monitor.sh
Claude-P0 e45cdb2d7d P0 BUSINESS DOSSIERS: 5 dossiers opérationnels prêts pour Yacine
- Kaouther (Ethica Group) contre-offre paliers DH
- Azure AD re-register MDEnt777, AdoraReborn, pwceducation
- OVH SMS credentials procédure
- OVH S151 cancel contrat (bleeding money)
- Gmail deliverability PMTA→O365 (reco: OPTION A)

- MD file: /opt/weval-l99/wiki/P0-BUSINESS-DOSSIERS.md (5776 bytes)
- HTML preview: /p0-dossiers.php (HTTP 200, banner 4.8/10)
- WEVIA Master intent: p0_status wired (live HCPs 146668)
- Playwright: 6 sections verified
- L99: 304/304 preserved · chattr +i restored
2026-04-17 04:26:16 +02:00

52 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# WEVIA Proactive Monitor v1.0 — */5 cron
# Auto-check Docker + disk + RAM + services → auto-restart if needed
LOG="/var/log/proactive-monitor.log"
TS=$(date '+%Y-%m-%d %H:%M')
echo "[$TS] PROACTIVE CHECK" >> $LOG
# 1. Docker check — restart stopped containers
STOPPED=$(docker ps -a --filter "status=exited" --format "{{.Names}}" | grep -v "chatwoot" | head -5)
if [ -n "$STOPPED" ]; then
for C in $STOPPED; do
docker restart "$C" >> $LOG 2>&1
echo "[$TS] RESTARTED: $C" >> $LOG
done
fi
# 2. Disk check — alert if > 90%
DISK=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
if [ "$DISK" -gt 90 ]; then
echo "[$TS] DISK ALERT: ${DISK}%" >> $LOG
# Auto-clean old logs
find /var/log -name "*.log" -size +50M -mtime +3 -delete 2>/dev/null
docker system prune -f --filter "until=72h" >> $LOG 2>&1
echo "[$TS] AUTO-CLEAN done" >> $LOG
fi
# 3. RAM check — clear cache if > 85%
RAM_PCT=$(free | grep Mem | awk '{printf "%.0f", $3/$2*100}')
if [ "$RAM_PCT" -gt 85 ]; then
sync && echo 3 > /proc/sys/vm/drop_caches
echo "[$TS] RAM CLEAR: was ${RAM_PCT}%" >> $LOG
fi
# 4. Critical services check
for SVC in "ollama:11434" "qdrant:6333" "searxng:8888" "mattermost:8065"; do
NAME=$(echo $SVC | cut -d: -f1)
PORT=$(echo $SVC | cut -d: -f2)
if ! curl -s --max-time 2 "http://127.0.0.1:$PORT/" > /dev/null 2>&1; then
echo "[$TS] DOWN: $NAME:$PORT — attempting restart" >> $LOG
docker restart "$NAME" >> $LOG 2>&1 || true
fi
done
# 5. Nginx check
if ! nginx -t 2>/dev/null; then
echo "[$TS] NGINX CONFIG ERROR" >> $LOG
fi
echo "[$TS] CHECK DONE — disk=${DISK}% ram=${RAM_PCT}%" >> $LOG