homelab-codex-ws/services/fleet-prometheus/healthcheck.sh
oskar 4518b15f98 feat(fleet-prometheus): scaffold fleet liveness Prometheus (VPS)
Clean scaffold of a Prometheus instance dedicated to fleet liveness, deliberately
separate from the home `prom` on PIHA. Scrapes only itself + the VPS-local
node_exporter for now.

- image pinned to prom/prometheus:v3.5.0 (LTS) — no :latest anti-pattern
- TSDB retention 15d / 2GB on the tight VPS; --web.enable-lifecycle for reloads
- mem_limit 512m, oom_score_adj +200 (sacrificial OOM victim before control-plane)
- tailscale-internal exposure via plain published 9090, mirroring control-plane
- node_exporter scraped via host.docker.internal:9100 (it runs network_mode: host)
- secret-free prometheus.yml; alerting/rule_files left as commented placeholders
- in-container healthcheck via busybox wget (present in the image; curl is not)

Smoke: docker compose config OK; promtool check config SUCCESS; up -d ->
/-/healthy + /-/ready OK; both targets (prometheus, fleet-node) report up.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 18:07:18 +02:00

20 lines
586 B
Bash
Executable file

#!/bin/bash
# Host-side healthcheck for fleet-prometheus.
# Mirrors the vikunja pattern: confirm the container runs, then probe the API
# from the host.
# Container must be running
if ! docker ps --filter "name=fleet-prometheus" --filter "status=running" | grep -qw "fleet-prometheus"; then
echo "[FAIL] fleet-prometheus container is not running"
exit 1
fi
# Prometheus must report itself healthy
if ! curl -sf http://localhost:9090/-/healthy > /dev/null; then
echo "[FAIL] Prometheus is not healthy on :9090"
exit 1
fi
echo "[OK] fleet-prometheus is healthy"
exit 0