1 stable release
Uses new Rust 2024
new 1.0.0 | Apr 14, 2025 |
---|
#3 in #exporter-prometheus
28KB
374 lines
Docker Prometheus Exporter
Exports basic metrics from Docker to the defined endpoint with path /
or /metrics
for scraping by Prometheus.
V1 Breaking Changes
254a698
- RemovesDOCKER_HOST
environment variable. Now connects via Unix Socket or Windows Pipef7652c7
- Default behaviour forcontainer_health
metric now only reports the health status on containers with the following labeldocker-prometheus-exporter.metric.container_health.enabled
. This behaviour can be configured with theCONTAINER_HEALTH_FILTER_LABEL
environment variable608a1eb
- Default listen address changed to127.0.0.1
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 IDname - Container Name |
Environment Variables
Name | Description | Default |
---|---|---|
RUST_LOG |
Sets logging verbosity, see documentation | info |
LISTEN_ADDR |
Metrics endpoint listen address | 127.0.0.1 |
LISTEN_PORT |
Metrics endpoint listen port | 9000 |
CLIENT_IP_SOURCE |
Sets the Client IP source for logging, see documentation for valid values | ConnectInfo |
CONTAINER_HEALTH_FILTER_LABEL |
Whether the container_health metric should only report containers which have the docker-prometheus-exporter.metric.container_health.enabled=true label |
true |
Example Docker Compose
services:
docker-prometheus-exporter:
container_name: docker-prometheus-exporter
image: calum4/docker-prometheus-exporter:1
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- RUST_LOG=info,docker_prometheus_exporter=info
- LISTEN_ADDR=0.0.0.0
expose:
- "9000:9000"
ports:
- "127.0.0.1:9000:9000"
labels:
"docker-prometheus-exporter.metric.container_health.enabled": true
restart: unless-stopped
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
See CONTRIBUTING.md.
Dependencies
~19–31MB
~449K SLoC