1.4 KiB
1.4 KiB
Services Watchdog: HTTPError Handling Fix
Problem
services_watchdog.py was reporting services as DOWN when they returned HTTP 404 on /health. Some services (wavemind) don't have a /health endpoint but ARE alive — they return 404 from a running server, not connection refused.
Fix
Catch urllib.error.HTTPError separately from connection errors. Any HTTP response (200, 404, 500) means the server is alive and listening:
import urllib.request, urllib.error
for name, svc in SERVICES.items():
try:
r = urllib.request.urlopen(f"http://localhost:{svc['port']}/health", timeout=5)
ok += 1 # 200 = alive
except urllib.error.HTTPError:
ok += 1 # 404/500 = server is running, just no /health endpoint
except Exception:
print(f"[WATCHDOG] {name} DOWN")
down += 1
Services and their /health behavior
| Service | Port | /health | Status |
|---|---|---|---|
| goth-engine | 8000 | 200 | Normal |
| wavemind | 8001 | 404 | Expected — no /health endpoint |
| cline-pass | 20131 | 200 | Normal |
| lobehub (final) | 20140 | 200 | {"status":"ok","backend":"lobehub","models":20} |
Script Location
C:\Users\User\AppData\Local\hermes\scripts\services_watchdog.py
Related Cron Job
78a30ef7ef29 — services-watchdog-30m. Runs every 30 minutes. Checks goth-engine, cline-pass, wavemind. Deliver=telegram.