Grafana Cloud

HAProxy integration for Grafana Cloud

HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. It is particularly suited for very high traffic web sites and powers quite a number of the world’s most visited ones. Over the years it has become the de-facto standard opensource load balancer, is now shipped with most mainstream Linux distributions, and is often deployed by default in cloud platforms.

This integration monitors the load balancer and reverse proxy frontends and backends of HAProxy. The metrics are exposed through HAProxy directly, using the inbuilt prometheus-exporter which can be built into the version 2.x+ binary.

Use the walkthrough in Grafana Cloud to install the HAProxy integration.

Pre-install configuration for the HAProxy integration

Ensure that your HAProxy binary has the prometheus-exporter included, then make sure to configure a frontend which will serve the metrics.

A simple example configuration;

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

Post-install configuration for the HAProxy integration

The following agent configurations defines a scrape job that pulls the metrics from an HAProxy instance on localhost on the port defined in the example config above. If HAProxy is running on a different host the address must be adapted.

  wal_directory: /tmp/wal
    scrape_interval: 5s
    - name: integrations
        - job_name: haproxy-integration
            - targets: ['haproxy:8404']
        - url: http://cortex:9009/api/prom/push