HAProxy monitoring
This extension documentation is now deprecated and will no longer be updated. We recommend using the new HAProxy extension for improved functionality and support.
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 socket mode and HTTP monitoring mode.
Choosing an HAProxy monitoring mode
We recommend socket mode rather than HTTP mode.
- Socket mode monitoring:
HAProxy supports splitting processes and mapping them to CPU cores. This enables you to use all your CPU cores.
Multiple HAProxy process, socket, and process bindings can be detected automatically. Socket and process bindings are read from an HAProxy configuration file.
- HTTP mode monitoring:
Simpler to configure but less powerful
Does not support multiple HAProxy processes
When traffic is overwhelming, HAProxy can block HTTP statistics
Socket mode monitoring
HAProxy socket mode monitoring supports global (applicable to all hosts) and local (applicable to specific hosts only) configuration.
Prerequisites for socket mode
-
Supported HAProxy/HAPEE version for socket mode
This support includes HAProxy Enterprise Edition (HAPEE)
-
Dynatrace OneAgent version 1.113+
-
Dynatrace User (
dtuser
) with read privileges in the HAProxy configuration file -
Dynatrace User (
dtuser
) with read/write privileges in stats sockets -
Stats socket located in a directory in which Dynatrace User (
dtuser
) hasexecute
permissions -
Important: one socket for each running process
Configuring socket mode
Sample code for an HAProxy configuration file:
1global23stats socket /var/run/haproxy/process1.sock mode 600 level operator process 1 user dtuser4stats socket /var/run/haproxy/process2.sock mode 600 level operator process 2 user dtuser56stats timeout 30s7nbproc 2
Skipping admin socket
From OneAgent version 1.165, you can use #DYNATRACE.SKIP
in the HAProxy configuration file to mark sockets used for administration that you want Dynatrace to ignore. Dynatrace will not use the line following #DYNATRACE.SKIP
. In this example, admin.sock
will not be used to gather statistics.
1global23stats socket /var/run/haproxy/process1.sock mode 600 level operator process 1 user dtuser4stats socket /var/run/haproxy/process2.sock mode 600 level operator process 2 user dtuser56#DYNATRACE.SKIP7stats socket /var/run/haproxy/admin.sock mode 660 level admin89stats timeout 30s10nbproc 2
Activating HAProxy monitoring globally in socket mode
- In the Dynatrace menu, go to Settings.
- Select Monitoring > Monitored technologies.
Find the HAProxy entry.
- Turn on the Global monitoring switch for HAProxy.
Leave User, Password, and URL empty or select the Use socket mode check box.
After you turn HAProxy monitoring on globally, Dynatrace automatically activates HAProxy monitoring on all hosts and monitors all HAProxy components. When a new host running HAProxy is detected in the future, monitoring will be activated and metrics will be gathered automatically.
Activating HAProxy monitoring per host in socket mode
If you previously turned HAProxy global monitoring on, you must turn global monitoring off before you turn monitoring on per host. Navigate to Settings > Monitored technologies, find the HAProxy entry, and set the Global monitoring switch for HAProxy to the Off position.
To activate socket-mode monitoring per host:
- In the Dynatrace menu, go to Settings.
- Select Monitoring > Monitoring overview.
- Select the Hosts tab.
Find the host on which you want to monitor HAProxy and open it for editing.
- When the Monitored technologies table for the selected host is populated (it may take a moment), find the HAProxy entry.
- Turn on the Monitoring switch for HAProxy on this host.
Leave User, Password, and URL empty or select the Use socket mode checkbox.
After you turn HAProxy monitoring on for a host, Dynatrace automatically activates HAProxy monitoring on that host and monitors all HAProxy components on it.
HTTP mode monitoring
HAProxy HTTP mode monitoring supports global (applicable to all hosts) and local (applicable to specific hosts only) configuration.
Prerequisites for HTTP mode
- Supported HAProxy version for HTTP mode
Dynatrace OneAgent version 1.113+
HTTP stats enabled
Activating HAProxy monitoring globally in HTTP mode
- In the Dynatrace menu, go to Settings.
- Select Monitoring > Monitored technologies.
Find and expand the HAProxy entry.
- Clear the Use socket mode checkbox if it is selected.
- Depending on your HAProxy settings, enter either the User, Password, and URL (for example,
http://localhost:1936/haproxy?stats
) or simply enter a URI prefix. - Select Save.
- Turn on the Global monitoring switch for HAProxy.
After you turn HAProxy monitoring on globally, Dynatrace automatically activates HAProxy monitoring on all hosts and monitors all HAProxy components. When a new host running HAProxy is detected in the future, monitoring will be activated and metrics will be gathered automatically.
Activating HAProxy monitoring per host in HTTP mode
If you previously turned HAProxy global monitoring on, you must turn global monitoring off before you turn monitoring on per host. Navigate to Settings > Monitored technologies, find the HAProxy entry, and set the Global monitoring switch for HAProxy to the Off position.
To activate HTTP-mode monitoring per host:
- In the Dynatrace menu, go to Settings.
- Select Monitoring > Monitoring overview.
- Select the Hosts tab.
Find the host on which you want to monitor HAProxy and open it for editing.
- When the Monitored technologies table for the selected host is populated (it may take a moment), find the HAProxy entry and expand it for editing.
- Clear the Use socket mode checkbox if it is selected.
- Depending on your HAProxy settings, enter either the User, Password, and URL (for example,
http://localhost:1936/haproxy?stats
) or simply enter a URI prefix. - Select Save.
- Turn on the Monitoring switch for HAProxy on this host.
After you turn HAProxy monitoring on for a host, Dynatrace automatically activates HAProxy monitoring on that host and monitors all HAProxy components on it.
Configuring HAProxy anomaly detection
Extension events listed on Settings > Anomaly detection > Extension events page.
- High HAProxy requests queue
Raise an alert if Queued requests is detected to be above the threshold value of x count/min for y minutes during any z minute period. - High frontend session usage
Raise an alert if Frontend session usage is detected to be above the threshold value of x% for y minutes during any z minute period. - High HAProxy frontend session usage
Raise an alert if Frontend session usage is detected to be above the threshold value of x% for y minutes during any z minute period. - Low HAProxy idle time
Raise an alert if Idle is detected to be below the threshold value of x% for y minutes during any z minute period. - High HAProxy response time
Raise an alert if Response time is detected to be above the threshold value of x [ microseconds | milliseconds | seconds | minutes | hours ] for y minutes during any z minute period. - High HAProxy backend session usage
Raise an alert if Backend session usage is detected to be above the threshold value of x% for y minutes during any z minute period.
Docker support
Dynatrace supports HAProxy running inside Docker containers with the following requirements:
- Supported HAProxy Docker image
Dynatrace OneAgent version 1.159+
- For HTTP mode, you need to expose the port that's used for HTTP queries.
Example:docker run haproxy -p 1936:1936
- For socket mode, no further configuration is required.
Example:docker run haproxy
HAProxy monitoring metrics
HAProxy metrics captured by the HAProxy monitoring plugin are displayed on all HAProxy process pages. Click into the infographic or click the HAProxy metrics and Further details tabs to view all available metrics.
Metric | Frontend? | Backend? | Description |
---|---|---|---|
Requests | x | HTTP requests per second. | |
Current sessions | x | x | Number of sessions created per second. |
Request errors | x | Some possible causes:
| |
Queued requests | x | The current number of queued requests. For the backend, this is the number of requests queued with no server assigned. | |
Connection errors | x | The number of requests that encountered an error trying to connect to a backend server. This is the sum of the statistic for all servers for that backend, plus any connection errors not associated with a particular server (such as the backend having no servers). | |
Response errors | x | Response errors include:
| |
Bytes received | x | x | The average incoming bytes per second. |
Bytes transmitted | x | x | The average outgoing bytes per second. |