////
This file is generated! See scripts/docs_collector.py
////

[[metricbeat-module-haproxy]]
== HAProxy module

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

To configure HAProxy to collect stats, you must enable the stats module, it can
be done by enabling a TCP socket, or by adding an HTTP stats frontend.

Metricbeat can collect two metric sets from HAProxy, `info` and `stats`. `info`
is not available when using HTTP stats frontend.

For example, to enable stats reporting via any local IP on port 14567, place
this statement under the `global` or `default` section of the haproxy config:

[source,haproxy]
----
 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.

To configure the HTTP stats frontend, a frontend with stats enabled has to
be added. For example, to open this frontend to any IP on port 14567 with
required authentication add this to the haproxy config:

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

The default metricsets are `info`and `stat`.

[float]
=== Compatibility

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


[float]
=== Example configuration

The HAProxy module supports the standard configuration options that are described
in <<configuration-metricbeat>>. Here is an example configuration:

[source,yaml]
----
metricbeat.modules:
- module: haproxy
  metricsets: ["info", "stat"]
  period: 10s
  hosts: ["tcp://127.0.0.1:14567"]
  enabled: true
----

[float]
=== Metricsets

The following metricsets are available:

* <<metricbeat-metricset-haproxy-info,info>>

* <<metricbeat-metricset-haproxy-stat,stat>>

include::haproxy/info.asciidoc[]

include::haproxy/stat.asciidoc[]

