HAProxy monitoring

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

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.

HAProxy performance monitoring metrics:

The Various out-of-the-box metrics we support are:

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.

How it works?

  • Log-in to your Site24x7 account. Sign up here if you don't have one.
  • Download and install the latest version of Site24x7 Linux Agent
  • Install the HAProxy plugin
  • The agent will execute the HAProxy plugin and push the data to the Site24x7 server

Prerequisites:

  • This is a Python based plugin and will support Python version 2.7 and greater

HAProxy plugin installation:

  • Create a directory with the name "haproxy", under the Site24x7 Linux Agent's plugin directory - /opt/site24x7/monagent/plugins/
  • Download the file "haproxy.py" from our GitHub repository and place it under the "haproxy" directory
  • Commands to perform the above step:
  • cd /opt/site24x7/monagent/plugins/
    mkdir haproxy
    cd haproxy
    wget https://raw.githubusercontent.com/site24x7/plugins/master/haproxy/haproxy.py
  • Once the plugin file is downloaded, the agent will mark it up in the next data collection and you can view it in Site24x7 client

HAProxy plugin configuration:

  • 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:80
    mode http
    stats enable
    stats uri /haproxy?stats
    stats realm Strictly\ Private
    stats auth userName:password
  • Save the changes and restart HAProxy using the following command (take caution while restarting in production servers)
  • /etc/init.d/haproxy restart
  • 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

Monitoring additional metrics:

  • To monitor additional metrics, edit the "haproxy.py" file and add the new metrics that need monitoring
  • Increment the plugin version value in the file "haproxy.py" to view the newly added metrics ( For e.g. change the default plugin version from PLUGIN_VERSION = "1" to "PLUGIN_VERSION = "2")

Related plugins:

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

World's leading companies

Client

Don't have a Site24x7 account? Sign up now!