This module collects stats from http://www.haproxy.org/[HAProxy]. It supports
collection from TCP sockets, UNIX sockets, or HTTP with or without basic
authentication.

Metricbeat can collect two metricsets from HAProxy: `info` and `stat`. `info`
is not available when using the stats page.

[float]
=== Configure HAProxy to collect stats

Before you can use Metricbeat to collect stats, you must enable the stats module
in HAProxy. You can do this a couple of ways: configure HAProxy to
report stats via a TCP or UNIX socket, or enable the stats page.

[float]
==== TCP socket

To enable stats reporting via any local IP on port 14567, add the following line
to the `global` or `default` section of the HAProxy config:

[source,shell]
----
 stats socket 127.0.0.1:14567
----

NOTE: You should use an internal private IP, or secure this with a firewall
rule, so that only designated hosts can access this data.

[float]
==== UNIX socket

To enable stats reporting via a UNIX socket, add the following line to the
`global` or `default` section of the HAProxy config:

[source,shell]
----
 stats socket /path/to/haproxy.sock mode 660 level admin
----

[float]
==== Stats page

To enable the HAProxy stats page, add the following lines to the HAProxy config,
then restart HAProxy. The stats page in this example will be available to any IP
on port 14567 after authentication.

[source,haproxy]
----
 listen stats
   bind 0.0.0.0:14567
   stats enable
   stats uri /stats
   stats auth admin:admin
----


[float]
=== Compatibility

The HAProxy metricsets are tested with HAProxy versions from 1.6 to 1.8.
