wacken89 / hetzner-load-balancer-prometheus-exporter Goto Github PK
View Code? Open in Web Editor NEWExports metrics from Hetzner Load Balancer for consumption by Prometheus
Exports metrics from Hetzner Load Balancer for consumption by Prometheus
Hi @wacken89 ,
First let me thank you for this great project!
I would like to place an idea/feature request. Would it be possible to add metrics (probably Gauges) to show the health status of the services (or service targets). If I understood the Hetzner API documentation, there should be a health state available via API.
Best regards,
Raffael
Hello,
I started your exporter with docker-compose:
hetzner-load-balancer-prometheus-exporter:
image: wacken/hetzner-load-balancer-prometheus-exporter:latest
container_name: hetzner-lb
expose:
- 8000
environment:
- LOAD_BALANCER_IDS="<id redacted>,<id redacted>"
- ACCESS_TOKEN="${HETZNER_API_TOKEN_READ}"
but it shows the following logs, I'm not sure if it's an "expected" message ?
hetzner-lb | 2022-06-30T16:11:30.498488714Z Hetzner Load Balancer Exporter is starting ...
hetzner-lb | 2022-06-30T16:11:30.498507667Z Getting Info from Hetzner ...
hetzner-lb | 2022-06-30T16:11:30.498510184Z
hetzner-lb | 2022-06-30T16:11:30.498511842Z Found Load Balancers
hetzner-lb | 2022-06-30T16:11:30.536478067Z Couldnt get field 'NoneType' object is not subscriptable
Thanks in advance for your help !
it should be possible to scrape multiple load balancers
It would be great to be able to pass the API token as a file instead of an environment variable, using secret mounts in Docker swarm, for example. This could be implemented by allowing to set the API_TOKEN_FILE
environment variable to a path of a file containing the actual token; the code would need to check whether that variable is set and points to a readable file, then read that; otherwise, fall back to the API_TOKEN
environment variable.
If you're interested, I'm happy to send a PR!
Depending on the support status of this project, would you consider adding support for the arm64 arch?
It would be awesome since Hetzner added support for arm64 a couple of months ago. This would allow users allow to run the image on any hetzner server/VM.
My usecase:
I run a mixed arch k8s cluster. I recently had the problem that the scheduler scheduled the pod on a arm64 node which could not run the current image. And since your implementation is pure python (no compiled and linked c libs) this would only require adding the plattform prob in the GitHub Action CI file.
Is it possible to publish the helm chart that is included in this repo to a public registry like https://artifacthub.io/?
It is possible via a GitHub Action and can even be stored as a GitHub pages file if artifacthub is not suitable
If not feel free to close this
Hello, I'm trying to use your exporter, but it doesn't work correctly for me.
I installed the latest version of the exporter in the Kubernetes cluster, added 2 dashboards and set the system requirements to default. For a period of time he worked. But after a few hours, my graphs for all load balancers began to show breaks.
As far as I understand, errors when trying to get data from the cloud and the name of the metrics can be different.
I tried to use the previous version 1.1.0, but it didn't help.
I tried to raise the system characteristics and it did not help either.
Then I decided to create another pod with an exporter and they started to fall at the same time.
I also tried setting different "SCRAPE_INTERVAL" times, but that didn't help either.
Deployment config:
apiVersion: apps/v1
kind: Deployment
metadata:
name: hetzner-load-balancer-prometheus-exporter
labels:
app: hetzner-load-balancer-prometheus-exporter
spec:
replicas: 1
selector:
matchLabels:
app: hetzner-load-balancer-prometheus-exporter
template:
metadata:
labels:
app: hetzner-load-balancer-prometheus-exporter
annotations:
prometheus.io/scrape: 'true'
prometheus.io/port: '8000'
prometheus.io/path: '/'
spec:
containers:
- name: exporter
image: wacken/hetzner-load-balancer-prometheus-exporter:latest
env:
- name: LOAD_BALANCER_IDS
value: "id"
- name: ACCESS_TOKEN
value: "token"
- name: SCRAPE_INTERVAL
value: '60'
resources:
requests:
memory: "128Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "250m"
ports:
- containerPort: 8000
LoadBalancer Config:
"id": <id_lb>>,
"name": "load_balancer1",
"public_net": {
"enabled": false,
"ipv4": {
"ip": "<ip_address>",
"dns_ptr": "static.<ip_address>.clients.your-server.de"
},
"ipv6": {
"ip": "<ip_address>",
"dns_ptr": ""
}
},
"private_net": [
{
"network": <id_network>,
"ip": "<ip_address>"
}
],
"location": {
"id": 2,
"name": "nbg1",
"description": "Nuremberg DC Park 1",
"country": "DE",
"city": "Nuremberg",
"latitude": 49.452102,
"longitude": 11.076665,
"network_zone": "eu-central"
},
"load_balancer_type": {
"id": 1,
"name": "lb11",
"description": "LB11",
"max_connections": 10000,
"max_services": 5,
"max_targets": 25,
"max_assigned_certificates": 10,
"deprecated": null,
"prices": [
{
"location": "hel1",
"price_hourly": {
"net": "0.0088000000",
"gross": "0.0096000000"
},
"price_monthly": {
"net": "5.3900000000",
"gross": "5.88000000"
}
},
{
"location": "ash",
"price_hourly": {
"net": "0.0088000000",
"gross": "0.0096000000"
},
"price_monthly": {
"net": "5.3900000000",
"gross": "5.88000000"
}
},
{
"location": "nbg1",
"price_hourly": {
"net": "0.0088000000",
"gross": "0.0096000000"
},
"price_monthly": {
"net": "5.3900000000",
"gross": "5.88000000"
}
},
{
"location": "fsn1",
"price_hourly": {
"net": "0.0088000000",
"gross": "0.0096000000"
},
"price_monthly": {
"net": "5.3900000000",
"gross": "5.88000000"
}
}
]
},
"protection": {
"delete": false
},
"labels": {
"env": "",
"name": "",
"project": "",
"created_by": "terraform",
"full_project_name": ""
},
"created": "2022-03-29T09:35:24Z",
"services": [
{
"protocol": "tcp",
"listen_port": 9000,
"destination_port": 9000,
"proxyprotocol": false,
"health_check": {
"protocol": "tcp",
"port": 9000,
"interval": 15,
"timeout": 10,
"retries": 3
}
},
{
"protocol": "tcp",
"listen_port": 8123,
"destination_port": 8123,
"proxyprotocol": false,
"health_check": {
"protocol": "tcp",
"port": 8123,
"interval": 15,
"timeout": 10,
"retries": 3
}
}
],
"targets": [
{
"type": "server",
"server": {
"id":
},
"health_status": [
{
"listen_port": 9000,
"status": "healthy"
},
{
"listen_port": 8123,
"status": "healthy"
}
],
"use_private_ip": true
},
{
"type": "server",
"server": {
"id":
},
"health_status": [
{
"listen_port": 9000,
"status": "healthy"
},
{
"listen_port": 8123,
"status": "healthy"
}
],
"use_private_ip": true
},
{
"type": "server",
"server": {
"id":
},
"health_status": [
{
"listen_port": 9000,
"status": "healthy"
},
{
"listen_port": 8123,
"status": "healthy"
}
],
"use_private_ip": true
},
{
"type": "server",
"server": {
"id":
},
"health_status": [
{
"listen_port": 9000,
"status": "healthy"
},
{
"listen_port": 8123,
"status": "healthy"
}
],
"use_private_ip": true
},
{
"type": "server",
"server": {
"id":
},
"health_status": [
{
"listen_port": 9000,
"status": "healthy"
},
{
"listen_port": 8123,
"status": "healthy"
}
],
"use_private_ip": true
},
{
"type": "server",
"server": {
"id":
},
"health_status": [
{
"listen_port": 9000,
"status": "healthy"
},
{
"listen_port": 8123,
"status": "healthy"
}
],
"use_private_ip": true
}
],
"algorithm": {
"type": "round_robin"
},
"outgoing_traffic": 0,
"ingoing_traffic": 2205000,
"included_traffic": 21990232555520
},
{
Could you help me to solve the problem? Thanks a lot.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.