Exports metrics from Hetzner Load Balancer for consumption by Prometheus
Go to Hetzner Console. Open project where you have running Load Balancer and create API TOKEN
in Security section
Next we sholud get ID
of our Load Balancer. This information we will get from Hetzner API
, everything about API
you find in official API documentation
Example curl
curl \
-H "Authorization: Bearer $API_TOKEN" \
'https://api.hetzner.cloud/v1/load_balancers'
Response sample
{
"load_balancers": [
{
"id": 4711,
"name": "Web Frontend",
"public_net": {
"enabled": false,
"ipv4": {
"ip": "1.2.3.4"
},
...
}
}
In deploy/kubernetes.yaml
add in env
section id which we got from API
and API TOKEN
env:
- name: LOAD_BALANCER_IDS
value: "11,22,33,44"
- name: ACCESS_TOKEN
value: "ewsfds43r*****132"
## Optional
- name: SCRAPE_INTERVAL
value: '60'
Enviroment | Description |
---|---|
LOAD_BALANCER_IDS |
Supported string with specific id 11,22,33 or all for scraping metrics from all load balancers in the project |
ACCESS_TOKEN |
Hetzner API token |
Optional SCRAPE_INTERVAL |
value in seconds, default value is 30 seconds |
Deploy it to Kubernetes cluster
kubectl apply -f deploy/kubernetes.yaml
kubectl port-forward <pod> 8000:8000
Open in your browser localhost:8000
:
Grafana Dashboard you can find here