This guide shows how to export HAProxy Enterprise's live traffic metrics to Grafana. We enable the built-in Prometheus metrics endpoint, which a Prometheus server scrapes at an interval. Then, Grafana displays graphs of the data stored in the Prometheus server.
Set up Prometheus and Grafana
Install a Prometheus server and configure it to scrape metrics from your HAProxy Enterprise load balancer. Follow our Prometheus guide, which shows how to:
enable HAProxy Enterprise's built-in Prometheus metrics exporter
configure your Prometheus server to scrape the Prometheus endpoint for live metrics
Prometheus hosts a dashboard on port 9090. Open the dashboard and verify that it can scrape the endpoint successfully. Check under the menu Status > Targets where you should see the HAProxy Enterprise endpoint with a state of UP.
Follow the official Grafana documentation to install Grafana.
Log into the Grafana dashboard at port 3000 using the username and password admin. You will be prompted to immediately change the password.
In the left-hand navigation, go to the Configuration screen and add a new Prometheus data source. Set the URL to the address where your Prometheus server is listening (e.g. http://localhost:9090), then save it.
Click the plus sign (+) in the left-hand navigation, then Create > Dashboard. Add a new panel to begin creating graphs that use metrics from the Prometheus data source.
The easiest way to achieve high availability for the above monitoring stack is to spin up a separate node with Prometheus and Grafana installed, and ingest the same data. For most use cases this is more than enough.
If you require a more robust high-availability solution, you can use Thanos. The project description states:
Thanos leverages the Prometheus 2.0 storage format to cost-efficiently store historical metric data in any object storage while retaining fast query latencies. Additionally, it provides a global query view across all Prometheus installations and can merge data from Prometheus HA pairs on the fly.
Also consider enabling the Prometheus Node Exporter to log the CPU, memory, and other system stats on every load balancer node. This will help catch maxed out CPU, high memory, and network congestion issues
Next upElastic Stack