Exports docker container stats as Prometheus compatible endpoint.
Project description
Prometheus Docker Exporter
Exports stats from Docker API (/containers/<id>/stat endpoint).
Metrics are collected on each request, everything in single thread. Fetching stats from Docker API for lots of containers on a small machine could take few seconds, but this implementation will not use host CPU excessively (looking at you, cAdvisor!).
Supported metrics
- cpu
- block i/o (cgroups v2)
- memory
- network
Usage
usage: glorpen-docker-exporter [-h] [-a ADDR] [-p PORT] [--sysfs SYSFS]
options:
-h, --help show this help message and exit
-a ADDR, --addr ADDR address to lsiten on, defaults to 0.0.0.0
-p PORT, --port PORT port to listen on, defaults to 8080
--sysfs SYSFS, -s SYSFS
path to sysfs to use, defaults to /sys
Access to /sys is needed for resolving block device names (/sys/dev/block).
Exporter needs r/w access to Docker socket (eg. /run/docker.sock).
Supported Docker envs:
DOCKER_HOST: The URL to the Docker host.DOCKER_TLS_VERIFY: Verify the host against a CA certificate.DOCKER_CERT_PATH: A path to a directory containing TLS certificates to use when connecting to the Docker host.
Docker
docker run -v /sys:/sys:ro -v /run/docker.sock:/run/docker.sock:rw glorpen/prometheus-docker-exporter:1.0.0
Pypi
pip install glorpen-docker-exporter
python -m glorpen-docker-exporter
Example Prometheus queries
CPU usage per container (as in docker stat command):
delta(container_cpu_seconds_total[2m]) / delta(container_cpu_system_seconds_total[2m]) * avg_over_time(container_cpu_online[2m])
Container HDD reads and writes:
rate(container_blkio_reads_bytes_total[2m]) > 0
rate(container_blkio_writes_bytes_total[2m]) > 0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file glorpen_docker_exporter-1.0.0-py3-none-any.whl.
File metadata
- Download URL: glorpen_docker_exporter-1.0.0-py3-none-any.whl
- Upload date:
- Size: 21.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.1 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ff751ae7d6554c27a56033442318acd8616996091e63fd2bb0cbd28189ea529
|
|
| MD5 |
6f289717156fd8569638383a23e21332
|
|
| BLAKE2b-256 |
b03c2f7211619732e7521e467083924004681d2105a845ee436fd550a816c1da
|