HAProxy is free, open source software that provides a high availability load balancer and proxy server for TCP and HTTP-based applications that spreads requests across multiple servers. Ensure optimal operation and performance through our HAProxy plugins.
This document details how to configure the HAProxy plugin and the monitoring metrics for providing in-depth visibility into the performance, availability, and usage stats of HAProxy servers.
request-errors metric counts and records the total number of errors that ocurred when requests were made to the proxy server by the client.
bytes-in metric counts and records the total number of bytes recieved by the frontend proxies in the last five seconds from the client.
The total number of bytes sent by the frontend proxies in the last five seconds is recorded using the metric
Current requests in queue
requests-queue-current records the total number of requests present in the process queue that are currently unassigned.
Current sessions rate
Use the metric
sessions-rate-current and get the total number of sessions created per second in the HAProxy setup.
- This is a Python-based plugin and will support Python version 2.7 and greater.
- Our Linux server monitoring agent should be installed in the network or on the specific host where the HAProxy load balancer is running.
- While adding a plugin, the plugin name and its folder name should be identical.
- Download and install the latest version of the Site24x7 Linux agent in the server where you plan to run the plugin. If it is installed successfully, you will see a Linux server monitor in the Site24x7 Control Panel. This confirms that the agent is able to communicate with our data center.
- Download the file haproxy.py from our GitHub repository.
- Edit your HAProxy configuration file which is located at - /etc/haproxy/haproxy.cfg and add the following code to enable the stats:
listen appname 0.0.0.0:80mode httpstats enablestats uri /haproxy?statsstats realm Strictly\ Privatestats auth userName:password
- Enter the username, password (if any) and the host and port which you want to monitor
*url = "http://localhost:80/haproxy?stats;csv"username = Nonepassword = None**realm = None*Retain the ";csv" prefix after adding your stats URL**Enter 'None' if no realm is specified in the HAProxy config file. Do not include any escape characters while adding this value
- Create a folder with the name 'haproxy', under the Site24x7 Linux Agent's plugin directory '/opt/site24x7/monagent/plugins/' and place the 'haproxy.py' file under '/opt/site24x7/monagent/plugins/haproxy'
Manually execute the plugin script using the following command and verify its output:
View Data in the Site24x7 Web Client
- Log in to Site24x7 and go to Server > Plugins > Name of plugin monitor.
- You will be able to view the performance charts on the various metrics for your HAProxy server.
- Elasticsearch plugin - Monitor performance metrics of your Elasticsearch systems
- MongoDB plugin - Monitor performance metrics of your MongoDB databases
- Varnish Cache plugin - Analyze performance of your Varnish Cache server
- Nagios plugin - Execute thousands of Nagios plugins in Site24x7 without the need of running a Nagios server
- Out-of-the-box plugins - Monitor your entire app stack with our extensive list of integrations
- Create custom plugins - Create custom Linux and Windows plugins and monitor custom attributes