---
title: "HAProxy integration | Grafana Cloud documentation"
description: "Learn about HAProxy Grafana Cloud integration."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# 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 allows you to collect metrics from the HAProxy instance and visualize them through pre-built dashboard in Grafana cloud.

This integration includes 3 useful alerts and 4 pre-built dashboards to help monitor and visualize HAProxy metrics.

## Before you begin

This integration monitors an HAProxy Server app that exposes metrics through the built-in [HAProxy Prometheus Exporter](https://github.com/haproxy/haproxy/tree/master/addons/promex) which can be built into the version 2.x+ binary.

A frontend configuration which is compatible with your existing HAProxy configuration is required. This configuration can be used as an example.

![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```none
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
```

## Install HAProxy integration for Grafana Cloud

1. In your Grafana Cloud stack, click **Connections** in the left-hand menu.
2. Find **HAProxy** and click its tile to open the integration.
3. Review the prerequisites in the **Configuration Details** tab and set up Grafana Alloy to send HAProxy metrics to your Grafana Cloud instance.
4. Click **Install** to add this integration’s pre-built dashboards and alerts to your Grafana Cloud instance, and you can start monitoring your HAProxy setup.

## Configuration snippets for Grafana Alloy

### Simple mode

These snippets are configured to scrape a single HAProxy instance running locally with default ports.

First, **manually** copy and append the following snippets into your alloy configuration file.

### Metrics snippets

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
discovery.relabel "metrics_integrations_integrations_haproxy" {
	targets = [{
		__address__ = "localhost:8404",
	}]

	rule {
		target_label = "instance"
		replacement  = constants.hostname
	}
}

prometheus.scrape "metrics_integrations_integrations_haproxy" {
	targets    = discovery.relabel.metrics_integrations_integrations_haproxy.output
	forward_to = [prometheus.remote_write.metrics_service.receiver]
	job_name   = "integrations/haproxy"
}
```

### Advanced mode

The following snippets provide examples to guide you through the configuration process.

To instruct Grafana Alloy to scrape your HAProxy instances, **manually** copy and append the snippets to your alloy configuration file, then follow subsequent instructions.

### Advanced metrics snippets

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
discovery.relabel "metrics_integrations_integrations_haproxy" {
	targets = [{
		__address__ = "localhost:8404",
	}]

	rule {
		target_label = "instance"
		replacement  = constants.hostname
	}
}

prometheus.scrape "metrics_integrations_integrations_haproxy" {
	targets    = discovery.relabel.metrics_integrations_integrations_haproxy.output
	forward_to = [prometheus.remote_write.metrics_service.receiver]
	job_name   = "integrations/haproxy"
}
```

To monitor your HAProxy instance, you must use a [discovery.relabel](/docs/alloy/latest/reference/components/discovery.relabel/) component to discover your HAProxy Prometheus endpoint and apply appropriate labels, followed by a [prometheus.scrape](/docs/alloy/latest/reference/components/prometheus.scrape) component to scrape it.

Configure the following properties within each `discovery.relabel` component:

- `__address__`: The address to your HAProxy Prometheus metrics endpoint.
- `instance` label: `constants.hostname` sets the `instance` label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this HAProxy instance.

If you have multiple HAProxy servers to scrape, configure one `discovery.relabel` for each and scrape them by including each under `targets` within the `prometheus.scrape` component.

## Dashboards

The HAProxy integration installs the following dashboards in your Grafana Cloud instance to help monitor your system.

- HAProxy / Backend
- HAProxy / Frontend
- HAProxy / Overview
- HAProxy / Server

## Alerts

The HAProxy integration includes the following useful alerts:

Expand table

| Alert                       | Description                                    |
|-----------------------------|------------------------------------------------|
| HAProxyDroppingLogs         | Critical: HAProxy is dropping logs.            |
| HAProxyBackendCheckFlapping | Critical: HAProxy backend checks are flapping. |
| HAProxyServerCheckFlapping  | Critical: HAProxy server checks are flapping.  |

## Metrics

The most important metrics provided by the HAProxy integration, which are used on the pre-built dashboards and Prometheus alerts, are as follows:

- haproxy\_backend\_bytes\_in\_total
- haproxy\_backend\_bytes\_out\_total
- haproxy\_backend\_check\_up\_down\_total
- haproxy\_backend\_connect\_time\_average\_seconds
- haproxy\_backend\_connection\_attempts\_total
- haproxy\_backend\_connection\_errors\_total
- haproxy\_backend\_http\_requests\_total
- haproxy\_backend\_internal\_errors\_total
- haproxy\_backend\_max\_connect\_time\_seconds
- haproxy\_backend\_max\_queue\_time\_seconds
- haproxy\_backend\_max\_response\_time\_seconds
- haproxy\_backend\_max\_total\_time\_seconds
- haproxy\_backend\_queue\_time\_average\_seconds
- haproxy\_backend\_response\_errors\_total
- haproxy\_backend\_response\_time\_average\_seconds
- haproxy\_backend\_status
- haproxy\_backend\_total\_time\_average\_seconds
- haproxy\_frontend\_bytes\_in\_total
- haproxy\_frontend\_bytes\_out\_total
- haproxy\_frontend\_connections\_total
- haproxy\_frontend\_http\_requests\_total
- haproxy\_frontend\_internal\_errors\_total
- haproxy\_frontend\_request\_errors\_total
- haproxy\_frontend\_status
- haproxy\_process\_current\_connections
- haproxy\_process\_dropped\_logs\_total
- haproxy\_process\_limit\_connection\_rate
- haproxy\_process\_limit\_session\_rate
- haproxy\_process\_limit\_ssl\_rate
- haproxy\_process\_max\_connections
- haproxy\_process\_max\_fds
- haproxy\_process\_max\_memory\_bytes
- haproxy\_process\_max\_pipes
- haproxy\_process\_max\_sockets
- haproxy\_process\_nbproc
- haproxy\_process\_nbthread
- haproxy\_process\_pool\_allocated\_bytes
- haproxy\_process\_pool\_used\_bytes
- haproxy\_process\_start\_time\_seconds
- haproxy\_server\_bytes\_in\_total
- haproxy\_server\_bytes\_out\_total
- haproxy\_server\_check\_up\_down\_total
- haproxy\_server\_connect\_time\_average\_seconds
- haproxy\_server\_connection\_attempts\_total
- haproxy\_server\_connection\_errors\_total
- haproxy\_server\_http\_responses\_total
- haproxy\_server\_internal\_errors\_total
- haproxy\_server\_max\_connect\_time\_seconds
- haproxy\_server\_max\_queue\_time\_seconds
- haproxy\_server\_max\_response\_time\_seconds
- haproxy\_server\_max\_total\_time\_seconds
- haproxy\_server\_queue\_time\_average\_seconds
- haproxy\_server\_response\_errors\_total
- haproxy\_server\_response\_time\_average\_seconds
- haproxy\_server\_status
- haproxy\_server\_total\_time\_average\_seconds
- up

## Changelog

md ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```md
# 1.1.0 - January 2026

* Update mixin to latest version
  * Changed upstream to http://github.com/grafana/jsonnet-libs/tree/master/haproxy-mixin
  * Template variables now use `allValue` of `.*` 

# 1.0.0 - February 2024

* Update mixin to replace all Angular panels with React based panels.

# 0.0.5 - August 2023

* New Filter Metrics option for configuring the Grafana Agent, which saves on metrics cost by dropping any metric not used by this integration. Beware that anything custom built using metrics that are not on the snippet will stop working.
* New hostname relabel option, which applies the instance name you write on the text box to the Grafana Agent configuration snippets, making it easier and less error prone to configure this mandatory label.

# 0.0.4 - January 2023

* Update mixin to the latest version
  - Update alert severity
  - Update dashboard labels


# 0.0.3 - September 2022

* Update dashboard panels.

# 0.0.2 - October 2021

* Update mixin to latest version:
  - Update the datasource template variable label to 'Data Source'

# 0.0.1 - April 2021

* Initial release
```

## Cost

By connecting your HAProxy instance to Grafana Cloud, you might incur charges. To view information on the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see [Active series and dpm usage](/docs/grafana-cloud/fundamentals/active-series-and-dpm/) and [Cloud tier pricing](/products/cloud/pricing/).
