
I built a Prometheus exporter for Docker Compose health monitoring
The problem I run multiple Docker Compose stacks on my homelab server (Jellyfin, Sonarr, Radarr, etc.). I needed a simple way to monitor the health of each service — whether it's running, restart count, CPU and memory usage — and expose those metrics to Prometheus for alerting and Grafana dashboards. Existing solutions were either too heavy or didn't understand Docker Compose service naming. I wanted something lightweight that auto-discovers docker-compose.yml and just works. The solution: docker-health-monitor A small Python CLI that: Parses docker-compose.yml to discover services Queries Docker daemon for container status, restart count, CPU%, memory Exposes metrics in Prometheus text format on /metrics Also provides a nice console status command with Rich tables Features Auto-discovery of docker-compose.yml (searches current dir and parents) Prometheus metrics: docker_compose_service_up , docker_compose_container_state , docker_compose_restart_count , docker_compose_cpu_percent , do
Continue reading on Dev.to Python
Opens in a new tab




