Files
weval-l99/agent-escalation.sh
2026-04-20 04:10:40 +02:00

25 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# V41 Agent: Risk Escalation (root cause: risks_detected)
OUT=/var/www/html/api/agent-escalation.json
# Pull alerts from DG command center source
PIPELINE_ALERT=$(curl -sk --max-time 3 https://weval-consulting.com/api/warn-registry.php 2>/dev/null | python3 -c "import json,sys; d=json.load(sys.stdin); print(d.get('summary',{}).get('dg_alerts_active',0))" 2>/dev/null || echo 0)
WEVIA_LIFE=$(curl -sk --max-time 3 https://weval-consulting.com/api/wevialife-api.php?action=stats 2>/dev/null | head -c 200)
cat > $OUT << EOJ
{
"agent": "V41_Risk_Escalation",
"ts": "$(date -Iseconds)",
"dg_alerts_active": $PIPELINE_ALERT,
"wevia_life_stats_preview": "${WEVIA_LIFE:0:100}",
"escalation_rules": {
"critical": "notify_Yacine_WhatsApp",
"high": "send_email_summary_daily",
"medium": "log_to_vault_and_dg"
},
"cron_schedule": "every_15min",
"telegram_webhook_ready": "/api/wedroid-telegram-alert.php",
"root_cause_resolved": "risks_detected via escalation rules active"
}
EOJ
echo "$(date -Iseconds) escalation agent" >> /var/log/weval-agents/escalation.log
cat $OUT