| 1 | # HAProxy collector |
| 2 | |
| 3 | Monitors frontend and backend metrics such as bytes in, bytes out, sessions current, sessions in queue current. |
| 4 | And health metrics such as backend servers status (server check should be used). |
| 5 | |
| 6 | Plugin can obtain data from URL or Unix socket. |
| 7 | |
| 8 | Requirement: |
| 9 | |
| 10 | - Socket must be readable and writable by the `netdata` user. |
| 11 | - URL must have `stats uri <path>` present in the haproxy config, otherwise you will get HTTP 503 in the haproxy logs. |
| 12 | |
| 13 | It produces: |
| 14 | |
| 15 | 1. **Frontend** family charts |
| 16 | |
| 17 | - Kilobytes in/s |
| 18 | - Kilobytes out/s |
| 19 | - Sessions current |
| 20 | - Sessions in queue current |
| 21 | |
| 22 | 2. **Backend** family charts |
| 23 | |
| 24 | - Kilobytes in/s |
| 25 | - Kilobytes out/s |
| 26 | - Sessions current |
| 27 | - Sessions in queue current |
| 28 | |
| 29 | 3. **Health** chart |
| 30 | |
| 31 | - number of failed servers for every backend (in DOWN state) |
| 32 | |
| 33 | ## Configuration |
| 34 | |
| 35 | Edit the `python.d/haproxy.conf` configuration file using `edit-config` from the Netdata [config |
| 36 | directory](/docs/netdata-agent/configuration/README.md), which is typically at `/etc/netdata`. |
| 37 | |
| 38 | ```bash |
| 39 | cd /etc/netdata # Replace this path with your Netdata config directory, if different |
| 40 | sudo ./edit-config python.d/haproxy.conf |
| 41 | ``` |
| 42 | |
| 43 | Sample: |
| 44 | |
| 45 | ```yaml |
| 46 | via_url: |
| 47 | user: 'username' # ONLY IF stats auth is used |
| 48 | pass: 'password' # # ONLY IF stats auth is used |
| 49 | url: 'http://ip.address:port/url;csv;norefresh' |
| 50 | ``` |
| 51 | |
| 52 | OR |
| 53 | |
| 54 | ```yaml |
| 55 | via_socket: |
| 56 | socket: 'path/to/haproxy/sock' |
| 57 | ``` |
| 58 | |
| 59 | If no configuration is given, module will fail to run. |
| 60 | |
| 61 | |
| 62 | ### Troubleshooting |
| 63 | |
| 64 | To troubleshoot issues with the `haproxy` module, run the `python.d.plugin` with the debug option enabled. The |
| 65 | output will give you the output of the data collection job or error messages on why the collector isn't working. |
| 66 | |
| 67 | First, navigate to your plugins directory, usually they are located under `/usr/libexec/netdata/plugins.d/`. If that's |
| 68 | not the case on your system, open `netdata.conf` and look for the setting `plugins directory`. Once you're in the |
| 69 | plugin's directory, switch to the `netdata` user. |
| 70 | |
| 71 | ```bash |
| 72 | cd /usr/libexec/netdata/plugins.d/ |
| 73 | sudo su -s /bin/bash netdata |
| 74 | ``` |
| 75 | |
| 76 | Now you can manually run the `haproxy` module in debug mode: |
| 77 | |
| 78 | ```bash |
| 79 | ./python.d.plugin haproxy debug trace |
| 80 | ``` |
| 81 |