As of 2.0.0, HAProxy includes a Prometheus exporter module that can be built into your binary during build time.

To build with the official Prometheus exporter module, make with the following EXTRA_OBJS flag:

make TARGET=linux-glibc EXTRA_OBJS="contrib/prometheus-exporter/service-prometheus.o"

Once built, you can enable and configure the Prometheus endpoint from your haproxy.cfg file as a typical frontend:

frontend stats
   bind *:8404
   option http-use-htx
   http-request use-service prometheus-exporter if { path /metrics }
   stats enable
   stats uri /stats
   stats refresh 10s

Put the configuration above in the HAProxy configuration file and then restart the HAProxy service and then go to the following URL

http://<Ip-address>:8404/metrcs

Speak with an expert on our team to discuss Cloud solutions tailored to your business.

You’ll receive free recommendations tailored to your business.