feat: add federation health monitoring, fix uptime monitor auth

Created federation-health-check.sh tracking peer online/offline state,
DWN sync status, and federation success rate. Fixed uptime-monitor.sh
to authenticate for system.stats RPC. Both run every 5min via cron
on primary server (UPTIME-01).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-13 03:38:33 +00:00
co-authored by Claude Opus 4.6
parent 193f80f1c1
commit 4500e949d8
3 changed files with 120 additions and 3 deletions
+10 -2
View File
@@ -36,9 +36,17 @@ HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 "$BACKEND_URL
HTTP_END=$(date +%s%N)
RESPONSE_MS=$(( (HTTP_END - HTTP_START) / 1000000 ))
# Get system stats from RPC
STATS=$(curl -s --max-time 10 -X POST "$RPC_URL" \
# Authenticate for RPC access
curl -s -c /tmp/uptime-cookies --max-time 5 -X POST "$RPC_URL" \
-H "Content-Type: application/json" \
-d '{"method":"auth.login","params":{"password":"password123"}}' >/dev/null 2>&1
CSRF=$(grep csrf_token /tmp/uptime-cookies 2>/dev/null | awk '{print $NF}')
# Get system stats from RPC
STATS=$(curl -s --max-time 10 -b /tmp/uptime-cookies \
-H "Content-Type: application/json" \
-H "X-CSRF-Token: $CSRF" \
-X POST "$RPC_URL" \
-d '{"method":"system.stats"}' 2>/dev/null || echo '{"result":{}}')
CPU=$(echo "$STATS" | python3 -c "import sys,json; d=json.load(sys.stdin).get('result',{}); print(d.get('cpu_usage_percent',0))" 2>/dev/null || echo "0")