This is a custom API written with FastAPI Python framework that forwards Prometheus Node-Exporter metrics data over secured endpoint with Bearer Auth
Fully complete docker-compose.yml
ready to deploy, you only need to update API_BEARER_TOKEN
env variable
services:
node-exporter:
image: quay.io/prometheus/node-exporter:latest
container_name: node-exporter
command:
- '--path.rootfs=/host'
pid: host
restart: unless-stopped
volumes:
- /:/host:ro,rslave
api:
image: abelodev/node-exporter-secure:latest
container_name: node-exporter-secure
environment:
API_BEARER_TOKEN: "token"
command: ["sh", "-c", "uvicorn app.main:app --host=0.0.0.0 --port=8000"]
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://node-exporter-secure:8000/debug/healthcheck"]
interval: 1m
timeout: 10s
ports:
- "9100:8000"
depends_on:
- node-exporter
ENV
-DEV
orPROD
. Production env disables/docs
,/redoc
and/openapi.json
endpoints.PROD
is set by default.API_BEARER_TOKEN
- Your Bearer token authMETRICS_ROUTE
- Metrics route. Default set to/metrics
NODE_EXPORTER_METRICS_PATH
- Node-Exporter endpoint path. Default set tohttp://node-exporter:9100/metrics