|
||
---|---|---|
.drone.yml | ||
check-storage.sh | ||
Dockerfile | ||
header.sh | ||
LICENSE.md | ||
README.md |
Hetzner Storage Exporter
Initially forked from https://github.com/gmasil/hetzner-storagebox-exporter.
- Applied some improvements
- Adapted documentation
- Added pipeline for publish to DockerHub
This is a simple prometheus exporter to provide storage space metrics of a Hetzner Storagebox.
Example
The exporter will start a webserver on port 80 (no HTTPS/TLS) and provide its metrics under every URI. The exporter checks the storage box under a given USERNAME
.
A SSH private key to login via SSH has to be provided and SSH has to be enabled in Hetzner Robot.
Here you can see an example output of the hetzner-storage-exporter:
# HELP hetzner_storage_available Available storage in kilobytes
# TYPE hetzner_storage_available gauge
hetzner_storage_available{host="u123456.your-storagebox.de"} 1062381134
# HELP hetzner_storage_used Used storage in kilobytes
# TYPE hetzner_storage_used gauge
hetzner_storage_used{host="u123456.your-storagebox.de"} 11360690
# HELP hetzner_storage_total Total storage in kilobytes
# TYPE hetzner_storage_total gauge
hetzner_storage_total{host="u123456.your-storagebox.de"} 1073741824
Build
Build simply with docker:
docker build --no-cache -t "varakh/hetzner-storagebox-exporter:latest" .
Note: This will build an image called varakh/hetzner-storagebox-exporter:latest
.
Usage
The exporter will listen on port 80 and exposes it by default.
You have to provide your username for your storage box via environment variable USERNAME
and a SSH private key to login.
Additionally you need a known_hosts
file to accept the SSH connection.
Usage with docker
:
docker run --rm -p 80:80 -e "USERNAME=u123456" \
-v "/home/myuser/.ssh/id_rsa:/root/.ssh/id_rsa" \
-v "/home/myuser/.ssh/known_hosts:/root/.ssh/known_hosts" \
varakh/hetzner-storagebox-exporter:latest
Example docker-compose
file:
version: '3'
services:
hetzner-storage-exporter:
container_name: hetzner-storage-exporter
restart: unless-stopped
image: varakh/hetzner-storagebox-exporter:latest
port:
- "9494:80"
environment:
- "USERNAME=u123456"
volumes:
- "/home/myuser/.ssh/id_rsa:/root/.ssh/id_rsa"
- "/home/myuser/.ssh/known_hosts:/root/.ssh/known_hosts"
Prometheus
In your prometheus.yml
you can add the hetzner-storage-exporter like this:
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: "hetznerstorage"
static_configs:
- targets:
- hetzner-storage-exporter:80
Note: As the exporter will provide the metrics on all URIs, you can leave all defaults like scraping on the /metrics
URI.