HAProxy
Overview
HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications.
This plugin is currently available for x86_64 Linux and Windows platforms.
Setup
The haproxy
plugin is included with the SolarWinds Snap Agent by default, please follow the directions below to enable it for a agent instance.
Prerequisites
This plugin requires that HAProxy is running and its stats endpoint API is available from the host where the plugin runs. The integration supports connecting via local/remote URI or unix socket.
This plugin fully supports HAProxy in versions from 1.4 up to 1.9
You might want to customize the relevant values in haproxy configuration file:
...
global
...
stats socket /run/haproxy/haproxy.sock mode 660 level admin
...
listen stats
bind 127.0.0.1:1936 # default
stats enable
stats auth admin:admin
stats realm HAProxy\ Statistics
stats show-node
stats uri /haproxy?stats # default
...
Configuration
The agent provides an example configuration file to help you get started quickly. It defines the plugin and task file to be loaded by the agent, but requires you to provide the correct settings for your HAProxy server. To enable the plugin:
1. Make a copy of the haproxy example configuration file /opt/SolarWinds/Snap/etc/plugins.d/haproxy.yaml.example
,
renaming it to /opt/SolarWinds/Snap/etc/plugins.d/haproxy.yaml
:
Copy$ sudo cp /opt/SolarWinds/Snap/etc/plugins.d/haproxy.yaml.example /opt/SolarWinds/Snap/etc/plugins.d/haproxy.yaml
- Update
/opt/SolarWinds/Snap/etc/plugins.d/haproxy.yaml
configuration file with settings specific to your HAProxy server for example:
Copycollector:
haproxy:
all:
## Endpoint URI (required)
## Setting should correspond to values set in 'listen stats' section in haproxy.cfg at 'bind', 'mode' and 'stats uri'
## should begin with http:// or https://
endpoint: "http://127.0.0.1:1936/haproxy?stats;csv"
##
## ... or with unix:// for socket-based connection, as set in haproxy.cfg at 'stats socket'
# endpoint: "unix:///run/haproxy/haproxy.sock"
##
## Can optionally include auth credentials
## Setting should correspond to value set in haproxy.cfg at 'stats auth' (if any), eg:
# endpoint: "http://username:password@127.0.0.1:1936/haproxy?stats;csv"
##
## Can also be a list of endpoints using embedded multiline YAML string syntax:
# endpoint: |
# list:
# - endpoint: http://127.0.0.1:1936/haproxy?stats;csv
# username: username
# password: password
# timeout: 15s
#
## Or in a simpler yet deprecated format:
# endpoint: |
# unix:///run/haproxy/haproxy.sock
# http://username:password@my.remote.service.com:1936/haproxy?stats;csv
#
## Timeout for connecting to HAProxy API
## Defaults to 5s
# timeout: "5s"
load:
plugin: snap-plugin-collector-aohaproxy
task: task-aohaproxy.yamlThe setting
endpoint
(required): should be set to the valid HAProxy API server IP or FQDN or unix socket path. Can be a single endpoint or a yaml multiline string with many endpoints (newline-delimited). For multiline YAML, a yaml-in-yaml syntax with embedded key-value settings is also supported (since version 9 of the plugin).The setting
timeout
(optional, defaults to5s
): it is a timeout for connecting to HAProxy stats endpoint.
- Restart the agent:
Copy$ sudo service swisnapd restart
- Enable the HAProxy plugin in the AppOptics UI
On the Integrations Page you will see the HAProxy plugin available if the previous steps were successful. If you do not see the plugin, see Troubleshooting Linux.
Select the HAProxy plugin to open the configuration menu in the UI, and enable the plugin.
You should soon see the
haproxy
metrics reported to your dashboard.
Metrics and Tags
The table below lists each of the metrics gathered from the status endpoint.
Default Metric Tags
All HAProxy metrics are tagged with hostname
. Instead of using this tag we recommend using the @host
alias.
Additionally, every metric is tagged with endpoint
, pxname
and svname
.
Metrics status
, check_status
, agent_status
and mode
are additionally tagged with their original textual values.
All Metrics
All metrics keep their original names as returned from HAProxy stats and are extensively described in the official HAProxy CSV stats docs <https://cbonte.github.io/haproxy-dconv/1.9/management.html#9.1>.
Every metric can be requested in the following form: /haproxy/<endpoint>/<pxname>/<svname>/<metric_name>
with the values in brackets given explicitly or using a wildcard (*
). For endpoint(s), any valid substring of the requested endpoint(s) would work.
Only numeric metrics are available with the exception of status
, check_status
, agent_status
and mode
which are mapped to sequential integer values and come with their original textual values as additional tags.
All available metrics list are listed below. Type values in are literally adapted from the official docs and state which type may have a value for given field. The types are L (Listeners), F (Frontends), B (Backends), and S (Servers).
CSV index | Types | Namespace | Description |
---|---|---|---|
2 | _ _ B S | haproxy.qcur | current queued requests. For the backend this reports the number queued without a server assigned. |
3 | _ _ B S | haproxy.qmax | max value of qcur |
4 | L F B S | haproxy.scur | current sessions |
5 | L F B S | haproxy.smax | max sessions |
6 | L F B S | haproxy.slim | configured session limit |
7 | L F B S | haproxy.stot | cumulative number of sessions |
8 | L F B S | haproxy.bin | bytes in |
9 | L F B S | haproxy.bout | bytes out |
10 | L F B _ | haproxy.dreq | requests denied because of security concerns. |
11 | L F B S | haproxy.dresp | responses denied because of security concerns. |
12 | L F _ _ | haproxy.ereq | request errors. |
13 | _ _ B S | haproxy.econ | number of requests that encountered an error trying to connect to a backend server. |
14 | _ _ B S | haproxy.eresp | response errors. srv_abrt will be counted here also. |
15 | _ _ B S | haproxy.wretr | number of times a connection to a server was retried. |
16 | _ _ B S | haproxy.wredis | number of times a request was redispatched to another server. The server value counts the number of times that server was switched away from. |
17 | L F B S | haproxy.status | status (UP/DOWN/NOLB/MAINT/MAINT(via)/MAINT(resolution)…) |
18 | _ _ B S | haproxy.weight | total weight (backend), server weight (server) |
19 | _ _ B S | haproxy.act | number of active servers (backend), server is active (server) |
20 | _ _ B S | haproxy.bck | number of backup servers (backend), server is backup (server) |
21 | _ _ _ S | haproxy.chkfail | number of failed checks. (Only counts checks failed when the server is up.) |
22 | _ _ B S | haproxy.chkdown | number of UP->DOWN transitions. The backend counter counts transitions to the whole backend being down, rather than the sum of the counters for each server. |
23 | _ _ B S | haproxy.lastchg | number of seconds since the last UP<->DOWN transition |
24 | _ _ B S | haproxy.downtime | total downtime (in seconds). The value for the backend is the downtime for the whole backend, not the sum of the server downtime. |
25 | _ _ _ S | haproxy.qlimit | configured maxqueue for the server, or nothing in the value is 0 (default, meaning no limit) |
26 | L F B S | haproxy.pid | process id (0 for first instance, 1 for second, …) |
27 | L F B S | haproxy.iid | unique proxy id |
28 | L _ _ S | haproxy.sid | server id (unique inside a proxy) |
29 | _ _ _ S | haproxy.throttle | current throttle percentage for the server, when slowstart is active, or no value if not in slowstart. |
30 | _ _ B S | haproxy.lbtot | total number of times a server was selected, either for new sessions, or when re-dispatching |
31 | _ _ _ S | haproxy.tracked | id of proxy/server if tracking is enabled. |
32 | L F B S | haproxy.type | (0=frontend, 1=backend, 2=server, 3=socket/listener) |
33 | _ F B S | haproxy.rate | number of sessions per second over last elapsed second |
34 | _ F _ _ | haproxy.rate_lim | configured limit on new sessions per second |
35 | _ F B S | haproxy.rate_max | max number of new sessions per second |
36 | _ _ _ S | haproxy.check_status | status of last health check |
37 | _ _ _ S | haproxy.check_code | layer 5 - 7 code, if available |
38 | _ _ _ S | haproxy.check_duration | time in ms took to finish last health check |
39 | _ F B S | haproxy.hrsp_1xx | http responses with 1xx code |
40 | _ F B S | haproxy.hrsp_2xx | http responses with 2xx code |
41 | _ F B S | haproxy.hrsp_3xx | http responses with 3xx code |
42 | _ F B S | haproxy.hrsp_4xx | http responses with 4xx code |
43 | _ F B S | haproxy.hrsp_5xx | http responses with 5xx code |
44 | _ F B S | haproxy.hrsp_other | http responses with other codes (protocol error) |
46 | _ F _ _ | haproxy.req_rate | HTTP requests per second over last elapsed second |
47 | _ F _ _ | haproxy.req_rate_max | max number of HTTP requests per second observed |
48 | _ F B _ | haproxy.req_tot | total number of HTTP requests received |
49 | _ _ B S | haproxy.cli_abrt | number of data transfers aborted by the client |
50 | _ _ B S | haproxy.srv_abrt | number of data transfers aborted by the server (inc. in eresp) |
51 | _ F B _ | haproxy.comp_in | number of HTTP response bytes fed to the compressor |
52 | _ F B _ | haproxy.comp_out | number of HTTP response bytes emitted by the compressor |
53 | _ F B _ | haproxy.comp_byp | number of bytes that bypassed the HTTP compressor (CPU/BW limit) |
54 | _ F B _ | haproxy.comp_rsp | number of HTTP responses that were compressed |
55 | _ _ B S | haproxy.lastsess | number of seconds since last session assigned to server/backend |
58 | _ _ B S | haproxy.qtime | the average queue time in ms over the 1024 last requests |
59 | _ _ B S | haproxy.ctime | the average connect time in ms over the 1024 last requests |
60 | _ _ B S | haproxy.rtime | the average response time in ms over the 1024 last requests (0 for TCP) |
61 | _ _ B S | haproxy.ttime | the average total session time in ms over the 1024 last requests |
62 | _ _ _ S | haproxy.agent_status | status of last agent check. |
63 | _ _ _ S | haproxy.agent_code | numeric code reported by agent if any (unused for now) |
64 | _ _ _ S | haproxy.agent_duration | time in ms taken to finish last check |
67 | _ _ _ S | haproxy.check_rise | server's ‘rise' parameter used by checks |
68 | _ _ _ S | haproxy.check_fall | server's ‘fall' parameter used by checks |
69 | _ _ _ S | haproxy.check_health | server's health check value between 0 and rise+fall-1 |
70 | _ _ _ S | haproxy.agent_rise | agent's ‘rise' parameter, normally 1 |
71 | _ _ _ S | haproxy.agent_fall | agent's ‘fall' parameter, normally 1 |
72 | _ _ _ S | haproxy.agent_health | agent's health parameter, between 0 and rise+fall-1 |
75 | L F B S | haproxy.mode | proxy mode (tcp, http, health, unknown) |
77 | _ F _ _ | haproxy.conn_rate | number of connections over the last elapsed second |
78 | _ F _ _ | haproxy.conn_rate_max | highest known conn_rate |
79 | _ F _ _ | haproxy.conn_tot | cumulative number of connections |
80 | _ F B _ | haproxy.intercepted | cum. number of intercepted requests (monitor, stats) |
81 | L F _ _ | haproxy.dcon | requests denied by ‘tcp-request connection' rules |
82 | L F _ _ | haproxy.dses | requests denied by ‘tcp-request session' rules |
83 | L F B S | haproxy.wrew | cumulative number of failed header rewriting warnings |
When the APM Integrated Experience is enabled, AppOptics shares a common navigation and enhanced feature set with the other integrated experiences' products. How you navigate AppOptics and access its features may vary from these instructions. For more information, go to the APM Integrated Experience documentation.
The scripts are not supported under any SolarWinds support program or service. The scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The risk arising out of the use or performance of the scripts and documentation stays with you. In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation.