> For the complete documentation index, see [llms.txt](https://docs.percona.com/percona-monitoring-and-management/3/llms.txt).

# Connect HAProxy databases to PMM

Monitor your HAProxy load balancer performance with Percona Monitoring and Management (PMM). PMM collects metrics from HAProxy’s built-in Prometheus endpoint to provide insights into proxy performance, backend health, and traffic patterns.

## Prerequisites

Before adding HAProxy to PMM, ensure:

1. HAProxy configured with metrics endpoint.

   - HAProxy must expose Prometheus metrics. See [How to configure HAProxy](https://www.haproxy.com/blog/haproxy-exposes-a-prometheus-metrics-endpoint).
   - Default metrics endpoint: `http://localhost:8404/metrics`
   - Verify metrics are accessible: `curl http://localhost:8404/metrics`

1. PMM Client installed and configured

1. PMM Client (pmm-agent) running on the same host as HAProxy

1. Node registered with PMM Server using pmm-admin config

## Add HAProxy service

Add HAProxy monitoring with the required port specification:

```sh
pmm-admin add haproxy --listen-port=8404
```

where `listen-port` is the port number where HAProxy is running. This is the only required flag.

Successful output

```text
HAProxy Service added.
Service ID  : c481183f-70a2-443f-91e5-cae5cecd06a2
Service name: Ubuntu-haproxy
```

### Advanced configuration options

Customize the HAProxy service with additional parameters:

```sh
# With authentication
pmm-admin add haproxy --listen-port=8404 --username=pmm --password=pmm MyHAProxy

# With custom metrics path and HTTPS
pmm-admin add haproxy --listen-port=8404 --metrics-path=/prom-metrics --scheme=https

# With custom service name
pmm-admin add haproxy --listen-port=8404 Production-HAProxy
```

#### Available options

- `--listen-port`: HAProxy metrics port (required)
- `--username`: Basic authentication username
- `--password`: Basic authentication password
- `--metrics-path`: Metrics endpoint path (default: /metrics)
- `--scheme`: Connection protocol (http or https)
- `--skip-connection-check`: Skip connectivity validation

### Via web UI

To add HAProxy through the PMM web interface:

1. Go to **Inventory > Add service**.
1. Select HAProxy from the service types.
1. Configure the connection parameters then click **Add Service**.

## Verify the connection

Check that HAProxy monitoring is active:

```sh
pmm-admin status
```

HAProxy data is visible in the **Advanced Data Exploration** dashboard:

*Image: !*
