I'm somewhat new to OPNsense. I am trying to use prometheus to collect metrics from HAProxy. Unfortunately, the default haproxy plugin does not have the built-in prometheus exporter enabled, as described in https://github.com/haproxy/haproxy/tree/master/addons/promex .
Is there a version of the haproxy plugin with promex enabled that I can use?
Thanks!
Opened a ticket to have this included:
https://github.com/opnsense/tools/issues/230
Hi there,
your ticket has been closed. Is the promex now build into HAProxy? And if so how did you configure it as there seams to be no GUI for it?
Henning
Updated to v21.7.1 and confirm the HAProxy built-in Prometheus exporter (promex) is working well now.
You can find a description how to set this up here:
https://www.haproxy.com/blog/haproxy-exposes-a-prometheus-metrics-endpoint/#configuring-prometheus
https://forum.netgate.com/topic/153766/haproxy-2-0-prometheus-monitoring-how-to
I added a Public Service through the GUI, which resulted in this config:
# Frontend: Prometheus (Prometheus metrics exporter)
frontend Prometheus
bind *:9105 name *:9105
mode http
option http-keep-alive
# tuning options
maxconn 10
timeout client 30s
# logging options
option dontlog-normal
# WARNING: pass through options below this line
option http-use-htx
http-request use-service prometheus-exporter if { path /metrics }
Hope it helps!
Yes, helps a lot. Thank you!!
os-haproxy version 3.12 will include GUI options to enable the Prometheus exporter:
https://github.com/opnsense/plugins/issues/2764#issuecomment-1287528782