Add configuration option for native prometheus exporter

HAProxy added native Prometheus support from v2.0. This can be
enabled using the existing stats endpoint via an additional
/metrics path.

Change-Id: If9528969c7915db06138c0746dc419d8302f0e7c
This commit is contained in:
Andrew Bonney 2021-07-30 09:07:50 +01:00
parent 1dc4fa621c
commit 964a33558b
2 changed files with 7 additions and 0 deletions

View File

@ -33,6 +33,9 @@ haproxy_stats_port: 1936
haproxy_username: admin
haproxy_stats_password: secrete
haproxy_stats_refresh_interval: 60
# Prometheus stats are supported from HAProxy v2
# Stats must be enabled above before this can be used
haproxy_stats_prometheus_enabled: False
# Pin stats gathering to one or more processes when using 'nbproc' tuning
# For permitted options see https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#3.1-stats%20bind-process
# haproxy_stats_process: all

View File

@ -46,6 +46,10 @@ listen stats
bind-process {{ haproxy_stats_process }}
{% endif %}
mode http
{% if haproxy_stats_prometheus_enabled | bool %}
option http-use-htx
http-request use-service prometheus-exporter if { path /metrics }
{% endif %}
stats enable
stats hide-version
stats realm Haproxy\ Statistics