Add autonomous monitor: 5-min systemd timer + on-chain USDC balance check

deploy/monitor.py probes /health, /mcp/rpc initialize, /scan x402 challenge,
and reads USDC.balanceOf(wallet) on Base mainnet via public RPC. Appends one
JSON line per run to data/monitor.jsonl and persists state to detect:
- service_down / ingest_stale / mcp_transport_broken / x402_misconfig
- FIRST_PAYMENT_RECEIVED (when wallet balance crosses 0)
- balance_changed (delta vs previous run)

Installed as aegis402-monitor.{service,timer} on the VPS with hardened
systemd sandbox (NoNewPrivileges, ProtectSystem=strict, ReadWritePaths
limited to data/). Timer active, first run green: cves=500, mcp=ok,
x402 challenge returns 402 with payTo=0x3D1F...4ff6, balance=0 USDC.
This commit is contained in:
Kaouani Jaouad
2026-04-13 13:20:31 +02:00
parent ca764b6766
commit 6df6b80a68
5 changed files with 259 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
{"ts":"2026-04-13T11:19:54.562833+00:00","alerts":[],"health":{"ok":true,"status":200,"cves":500,"affected_packages":732,"ingest_age_seconds":2927.686714,"ingest_status":"ok"},"mcp_rpc":{"ok":true,"status":200,"session_id":"STkH8Wtm2x1TtPkJBG22bw","protocol_version":"2025-03-26","server_name":"aegis402"},"x402_challenge":{"ok":true,"status":402,"price_atomic":"5000","pay_to":"0x3D1F0F7E51392f85877dB107696d5b3f591E4ff6"},"wallet":{"ok":true,"wallet":"0x3D1F0F7E51392f85877dB107696d5b3f591E4ff6","status":200,"balance_atomic":0,"balance_usdc":0.0}}
+4
View File
@@ -0,0 +1,4 @@
{
"last_balance_atomic": 0,
"last_balance_check": "2026-04-13T11:19:54.562833+00:00"
}