You are here

HAProxy Monitoring

Requires Opsview Cloud or Opsview Monitor 6
check_circle
Opsview Supported

HAProxy Opspack

HAProxy is a free tool offering high availability, load balancing, and proxying for TCP and HTTP-based applications. Well-suited for high traffic websites, HAProxy has become the industry standard open-source load balancer and is often shipped with most mainstream Linux distributions as well as commonly deployed by default in cloud platforms.

Its mode of operation makes integration into existing architectures quite simple and keeps security top of mind, ensuring that valuable web servers with private information are not exposed.

What You Can Monitor

This Opspack allows you to monitor all the metrics you need to efficiently run a HAProxy Server, providing service checks for connections, requests, responses and sessions, as well as the number of ingoing and outgoing bytes.

Service Checks

Service Check Description
Bytes Checks the bytes in and bytes out
Connect Time The time in ms for a session to connect
Currrent Queue The current number in the queue
Denied Connection The number of denied connections
Denied Requests The number of denied requests
Denied Response The number of denied responses
Denied Sessions The number of denied sessions
Error Connections The number of error connections
Error Requests The number of error requests
Error Response The number of error responses
Intercepted Requests The number of intercepted requests
Queue Time The time in ms of the queue session
Request Rate The number of requests per second
Request Time The time in ms of the session request
Response Codes The number of code responses of each type
Session Rate The number of sessions per second
Sessions Used The percentage of used sessions
Status Checks the status of the proxy
Warnings Redispatched The number of redispatched warnings
Warnings Retried The number of retried warnings

Set up HAProxy for Monitoring

HAProxy has been tested against version 1.5, 1.6 and 1.7. If you are running HAProxy version 1.5 or 1.6 three service checks will need to be deactivated as the metrics are not available for those versions, these are; denied connections, denied sessions and intercepted requests.

To configure HAProxy, you need to set up a statistics page on the server.

Step 1: Update the haproxy.cfg

Update /etc/haproxy/haproxy.cfg with the lines below for each proxy.

listen stats
    bind <Your haproxy IP>:<Port>
    mode http
    stats enable
    stats hide-version
    stats realm haproxy\ Statistics
    stats uri /haproxy?stats
    stats auth <Username>:<Password>

Step 2: Restart HAProxy

sudo service haproxy restart

Step 3: Test the stats are running correctly

Visit http://<Your haproxyIP>:<Port>/haproxy?stats and view the statistics.

Setup and Configuration

To configure and utilize this Opspack, you simply need to add the 'Application - Haproxy' Opspack to your Opsview Monitor system.

Step 1: Add the host template

Add the Application - Haproxy Host Template to your Opsview Monitor host.

For more information, refer to Opsview Knowledge Center - Adding Host Templates to Hosts.

Step 2: Add and configure variables required for this host

Variable Description
HAPROXY The information for your haproxy setup. Ensure you override Username, Password, Port and Stats Path with the same values as your haproxy.cfg file.
HAPROXY_PROXY The Value is the name of the HAProxy you want to monitor. You can add multiple variables to check the status of each proxy individually.

For more information, refer to Opsview Knowledge Center - Adding Variables to Hosts.

Step 3: Apply changes and the system will now be monitored

HAProxy Service Checks