From 72e34c982cada98e9bc376de7c36e659862fb393 Mon Sep 17 00:00:00 2001 From: Aykhan Shahsuvarov Date: Thu, 9 Jul 2026 18:26:22 +0400 Subject: [PATCH] prometheus: add Hetzner storagebox exporter --- README.md | 1 + main.sh | 1 + prometheus/.env.example | 4 ++++ prometheus/data/config/prometheus.yaml | 5 +++++ prometheus/docker-compose.yaml | 19 +++++++++++++++++++ 5 files changed, 30 insertions(+) create mode 100644 prometheus/.env.example diff --git a/README.md b/README.md index 9bca15c..30af6be 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ Edit the generated `.env` files to fill in the required fields: - `./stalwart/.env` - `./caddy/.env` - `./crowdsec/.env` +- `./prometheus/.env` - `./caddy/Caddyfile.private` ### 4. Bouncer Keys (CrowdSec) diff --git a/main.sh b/main.sh index 34729ad..d243aa9 100755 --- a/main.sh +++ b/main.sh @@ -65,6 +65,7 @@ generate_env_files() { cp --update=none ./croc/.env.example ./croc/.env cp --update=none ./stalwart/.env.example ./stalwart/.env cp --update=none ./crowdsec/.env.example ./crowdsec/.env + cp --update=none ./prometheus/.env.example ./prometheus/.env cp --update=none ./caddy/Caddyfile.private.example ./caddy/Caddyfile.private print_success ".env files generated." } diff --git a/prometheus/.env.example b/prometheus/.env.example new file mode 100644 index 0000000..82eb74a --- /dev/null +++ b/prometheus/.env.example @@ -0,0 +1,4 @@ +############# Hetzner Storage Box exporter ############# +# Read-only Hetzner Cloud API token: Cloud Console -> Security -> API Tokens. +# The Storage Box must be managed via the Hetzner Cloud API. +HETZNER_TOKEN= diff --git a/prometheus/data/config/prometheus.yaml b/prometheus/data/config/prometheus.yaml index a920f25..6b04498 100644 --- a/prometheus/data/config/prometheus.yaml +++ b/prometheus/data/config/prometheus.yaml @@ -26,3 +26,8 @@ scrape_configs: scrape_interval: 30s static_configs: - targets: ["crowdsec_exporter:9100"] + + - job_name: storagebox_exporter + scrape_interval: 60s + static_configs: + - targets: ["storagebox_exporter:9509"] diff --git a/prometheus/docker-compose.yaml b/prometheus/docker-compose.yaml index 06dda56..5f96076 100644 --- a/prometheus/docker-compose.yaml +++ b/prometheus/docker-compose.yaml @@ -72,5 +72,24 @@ services: max-size: "100m" max-file: "3" + storagebox_exporter: + image: ghcr.io/crstian19/prometheus-storagebox-exporter:0.5 + container_name: storagebox_exporter + restart: unless-stopped + labels: + - "com.centurylinklabs.watchtower.enable=true" + networks: + - prometheus + environment: + HETZNER_TOKEN: "${HETZNER_TOKEN}" + LISTEN_ADDRESS: ":9509" + METRICS_PATH: "/metrics" + LOG_LEVEL: "info" + logging: + driver: "json-file" + options: + max-size: "100m" + max-file: "3" + volumes: prometheus-data: