Files
storyforge/scripts/status_collector.sh

22 lines
526 B
Bash
Executable File

#!/bin/sh
set -eu
ROOT="$(CDPATH= cd -- "$(dirname "$0")/.." && pwd)"
COMPOSE_FILE="$ROOT/docker-compose.yml"
cd "$ROOT"
docker compose -f "$COMPOSE_FILE" ps collector
echo "---"
python3 - <<'PY'
import urllib.request
url = "http://127.0.0.1:8081/healthz"
try:
with urllib.request.urlopen(url, timeout=5) as resp:
print(f"collector health: {resp.status}")
print(resp.read().decode("utf-8", "ignore")[:400])
except Exception as exc:
print(f"collector health error: {exc}")
raise SystemExit(1)
PY