How do I configure HAProxy monitoring?

HAProxy is a commonly used load-balancer and proxy for TCP and HTTP-based applications that is considered to be fast, reliable, and well-suited for high-traffic websites. We support both socket and HTTP monitoring modes. Socket mode is recommended though.

Socket mode configuration

From version 1.5-dev13 onwards, HAProxy supports splitting processes and mapping them to CPU cores. This feature enables you to use all your CPU cores. Also, multiple HAProxy process, socket and process bindings can be automatically detected. Socket and process bindings are read from a HAProxy configuration file.

Prerequisites:

  • HAProxy 1.5 or higher
  • Dynatrace OneAgent v1.113 (or higher)
  • Dynatrace User (dtuser) with read privileges in HAProxy configuration file
  • Dynatrace User (dtuser) with read/write privileges in stats sockets
  • Stat socket located in a directory in which Dynatrace User (dtuser) has execute permissions
  • one socket for each running process

Here is sample code for a HAProxy configuration file:

global

stats socket /var/run/haproxy/process1.sock mode 600 level operator process 1 user dtuser
stats socket /var/run/haproxy/process2.sock mode 600 level operator process 2 user dtuser

stats timeout 30s
nbproc 2

To activate HAProxy in a socket mode, please leave the User, Password and URL fields empty, as shown in the next image.

HAProxy Socket mode supports global (applicable to all hosts) and local (applicable to specific hosts only) configuration.

HTTP mode configuration

HTTP mode is simpler to configure, yet less powerful. It does not support multiple HAProxy processes and when traffic is overwhelming HAProxy can block HTTP stats. Depending on your HAProxy settings, enter either the User, Password, and URL for your HAProxy stats page (for example, http://localhost:1936/haproxy?stats), as shown in the image below, or simply enter a URI prefix.

Prerequisites:

  • Dynatrace OneAgent Agent v1.113 (or higher)
  • HAProxy v1.4 (or higher)
  • HTTP stats enabled

Note
HAProxy HTTP mode supports global (applicable to all hosts) and local (applicable to specific hosts only) configuration.