Files
routeros-suricata-tzsp/scripts/healthcheck.py
T
2026-08-17 10:07:19 +02:00

15 lines
399 B
Python
Executable File

#!/usr/bin/env python3
import json
import os
import sys
import urllib.request
try:
port = int(os.getenv("WEB_PORT", "8080"))
with urllib.request.urlopen(f"http://127.0.0.1:{port}/api/health", timeout=3) as response:
data = json.load(response)
raise SystemExit(0 if data.get("operational") else 1)
except Exception as exc:
print(exc, file=sys.stderr)
raise SystemExit(1)