kscarlett / hetzner-load-balancer-prometheus-exporter

Exports meterics from Hetner Load Balancer for consumption by Prometheus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hetzner Load Balancer Prometheus Exporter

Exports metrics from Hetzner Load Balancer for consumption by Prometheus

Preparing

API TOKEN

Go to Hetzner Console. Open project where you have running Load Balancer and create API TOKEN in Security section

api token

Load Balancer ID

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"
        },
...
    }
}

Configuring

In deploy/kubernetes.yaml add in env section id which we got from API and API TOKEN

env:
  - name: LOAD_BALANCER_ID
  value: ""
  - name: ACCESS_TOKEN
  value: ""

Deploy it to Kubernetes cluster

kubectl apply -f deploy/kubernetes.yaml

Check metrics page

kubectl port-forward <pod> 8000:8000

Open in your browser localhost:8000:

exporter metrics

Grafana

Grafana Dashboard you can find here

Metrics in Hetzner console Hetzner console

Metrics in Grafana exporter metrics

About

Exports meterics from Hetner Load Balancer for consumption by Prometheus


Languages

Language:Python 68.8%Language:Smarty 28.2%Language:Dockerfile 3.0%