Skip to content

Exports basic metrics from Docker for scraping by Prometheus

License

Notifications You must be signed in to change notification settings

Calum4/docker-prometheus-exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Prometheus Exporter

Exports basic metrics from Docker to the defined endpoint with path / or /metrics for scraping by Prometheus.

Disclaimer - I'm still new to Rust, feel free to make an issue and tell me why what I'm doing is dumb.

Available Metrics

Metric Name Description Units/Values Labels
docker_up Reports the state of Docker 0 - Offline
1 - Online
N/A
container_health Reports the health state of a Docker container 0 - Unknown
1 - Stopped
2 - Alive, no healthcheck
3 - Unhealthy
4 - Healthy
id - Container ID
name - Container Name

Environment Variables

Name Description Default
RUST_LOG Sets logging verbosity, see documentation info
DOCKER_HOST URI to the Docker API Unix - unix:///var/run/docker.sock
Other - tcp://127.0.0.1:2376
LISTEN_ADDR Metrics endpoint listen address 0.0.0.0
LISTEN_PORT Metrics endpoint listen port 9000

Example Docker Compose

services:
  docker-prometheus-exporter:
    container_name: docker-prometheus-exporter
    image: ghcr.io/calum4/docker-prometheus-exporter:latest
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - RUST_LOG=info,docker_prometheus_exporter=info
    expose:
      - "9000:9000"
    ports:
      - "127.0.0.1:9000:9000"
    restart: unless-stopped