This template retrieves status of a Haproxy server installed on Linux or Unix computer by using built-in stats page.
Prerequisites:
- SSH and Perl installed on the target server.
- SNMP installed on the target server and permission to monitor the Haproxy process.
- The Haproxy statistics page should be properly configured. To configure it, add the following lines into the haproxy.cfg file:
listen stats 0.0.0.0:port
mode http
log global
stats enable
stats hide-version
stats uri /statpage
stats auth login:password
Example:
listen stats 0.0.0.0:8001
mode http
log global
stats enable
stats hide-version
stats uri /stats
stats auth admin:qwerty
This will create the Haproxy statistics page for the following URL: http://haproxyserver:8001/stats which requires the correct credentials in order to access the page.
Login: admin
Password: qwerty
Note: This template was designed to work with URI /stats.
Credentials: Root credentials on the target server.
Note: This template was tested on Haproxy 1.5.9.
Monitored Components
Front End
This monitor returns statistics for Front End servers. The returned values are as follows:
Current Sessions – This component returns the number of Front End current sessions.
Max Sessions – This component returns the number maximum Front End sessions.
Total Sessions – This component returns the total number of Front End sessions.
Bytes In – This component returns the number of bytes in.
Bytes Out – This component returns the number of bytes out.
Denied Requests – This component returns the number of Front End denied requests.
Denied Responses – This component returns the number of Front End denied responses.
Request Errors – This component returns the number of Front End error requests.
Service Status – This component returns the Front End service status.
Possible values:
0 – Other.
1 – OPEN.
2 – UP.
3 – NOLB.
4 – MAINT.
5 – DOWN.
Note: Before using this monitor, the correct argument should be set. This monitor requires the following arguments:
perl ${SCRIPT} haport haproxy_login haproxy_password uri
where
haport – Port number of Haproxy stats page.
haproxy_login – Login name to access Haproxy stats page.
haproxy_password – Password to access Haproxy stats page.
uri – URI name of stats page.
Following is an example using the Scripts Arguments field (based on the example configuration above):
perl ${SCRIPT} 8001 admin qwerty stats
Back End
This monitor returns statistics for Back End servers. The returned values are as follows:
Current Requests – This component returns the number of Back End current requests.
Current Sessions – This component returns the number of Back End current sessions.
Total Sessions – This component returns the total number of Back End sessions.
Bytes In – This component returns the number of bytes in.
Bytes Out – This component returns the number of bytes out.
Denied Requests – This component returns the number of Back End denied requests.
Denied Responses – This component returns the number of Back End denied responses.
Connection Errors – This component returns the number of Back End connections errors.
Response Errors – This component returns the number of Back End error responses.
Service Status – This component returns the Back End service status.
Possible values:
0 – Other.
1 – OPEN.
2 – UP.
3 – NOLB.
4 – MAINT.
5 – DOWN.
Note: Before using this monitor, the correct arguments should be set. This monitor requires the following arguments:
perl ${SCRIPT} haport haproxy_login haproxy_password uri
where
haport – Port number of Haproxy stats page.
haproxy_login – Login name to access Haproxy stats page.
haproxy_password – Password to access Haproxy stats page.
uri – URI name of stats page.
Below is an example using the Scripts Arguments field (based on the example configuration above):
perl ${SCRIPT} 8001 admin qwerty stats
Process: haproxy
This monitor returns the CPU and memory usage of haproxy.
TCP Port: haproxy
This component monitor tests the ability of haproxy to accept incoming sessions. It monitors TCP Port 8000.
Copyright 2015. Portions of this template are based on the following documents:
- http://cbonte.github.io/haproxy-dconv/configuration-1.5.html
- http://feurix.org/projects/hatop/screenshots/
Last updated: 1/08/2015