Online Training
Q4 2024

Nov 19 to Dec 10

11.00 AM EST: USA, UK, Canada, Mexico and Europe

06.00 AM GMT: MiddleEast, Asia and Australia

Register Now

HAProxy Monitoring

Configure HAProxy plugins to ensure proper operation and performance of HAProxy, a TCP/HTTP load balancer.

Start 30-day free trial Try now, sign up in 30 seconds

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.

Performance Metrics

Request errors

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

bytes-in metric counts and records the total number of bytes recieved by the frontend proxies in the last five seconds from the client.

Bytes out

The total number of bytes sent by the frontend proxies in the last five seconds is recorded using the metric bytes-out.

Current requests in queue

The metric 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.

Prerequisites

  • 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.

Plugin Installation

  • 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.
    wget https://raw.githubusercontent.com/site24x7/plugins/master/haproxy/haproxy.py
  • Edit your HAProxy configuration file which is located at - /etc/haproxy/haproxy.cfg and add the following configurations to enable the stats:
    listen appname 0.0.0.0:80
    mode http
    stats enable
    stats uri /haproxy?stats
    stats realm Strictly\ Private
    stats 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 = None
    password = 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'
The agent will automatically execute the plugin within five minutes and send performance data to the Site24x7 data center.
Tip

Manually execute the plugin script using the following command and verify its output:

python haproxy.py

View Data in the Site24x7 Web Client

  1. Log in to Site24x7 and go to Server > Plugins > Name of plugin monitor.
  2. You will be able to view the performance charts on the various metrics for your HAProxy server.

Other Integrations:

  • 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