From 11d9bfca92e9ad461ee0144e8086547808dcc679 Mon Sep 17 00:00:00 2001 From: Google AI Agent Date: Mon, 6 Apr 2026 15:02:19 +0000 Subject: [PATCH] feat: add Failover Monitor for VPS fleet resilience --- scripts/failover_monitor.py | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 scripts/failover_monitor.py diff --git a/scripts/failover_monitor.py b/scripts/failover_monitor.py new file mode 100644 index 0000000..757ccc5 --- /dev/null +++ b/scripts/failover_monitor.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +import json +import os +import time +import subprocess +from pathlib import Path + +# Allegro Failover Monitor +# Health-checking the VPS fleet for Timmy's resilience. + +FLEET = { + "ezra": "143.198.27.163", # Placeholder + "bezalel": "167.99.126.228" +} + +STATUS_FILE = Path.home() / ".timmy" / "failover_status.json" + +def check_health(host): + try: + subprocess.check_call(["ping", "-c", "1", "-W", "2", host], stdout=subprocess.DEVNULL) + return "ONLINE" + except: + return "OFFLINE" + +def main(): + print("--- Allegro Failover Monitor ---") + status = {} + for name, host in FLEET.items(): + status[name] = check_health(host) + print(f"{name.upper()}: {status[name]}") + + STATUS_FILE.parent.mkdir(parents=True, exist_ok=True) + STATUS_FILE.write_text(json.dumps({ + "timestamp": time.time(), + "fleet": status + }, indent=2)) + +if __name__ == "__main__": + main() -- 2.43.0