HAProxy Monitoring

Quick Start

1. Install the OpsDash Smart Agent on the Apache or Nginx server that you wish to monitor. If you need instructions for how to do this, here they are:  Debian/UbuntuCentOS/RHELGeneric.

2. Edit the OpsDash Smart Agent configuration file at /etc/opsdash/agent.cfg and add a new service:

# choose a good, unique name for the service (here my-haproxy-1 is used)
service "my-haproxy-1" {
    type = "haproxy"

    # point to the HTTP URL for the stats page
    url = "http://127.0.0.1:9999/haproxy?stats"
    # you can also set the username and password if you have basic auth for the URL
    #user = "myuser"
    #pass = "mypass"

    # you can also use the stats socket instead of the HTTP URL:
    # url = "unix:///var/lib/haproxy/stats"
}

3. Reload the OpsDash Smart Agent so that it picks up the new configuration:

sudo service opsdash-agent reload

4. You should see the service my-haproxy-1 appear under  https://app.opsdash.com/sources within a minute or so. Clicking on it should take you to the dashboard at https://app.opsdash.com/source/my-haproxy-1. If it does not, check the agent log file at /var/log/opsdash/agent.log.

HAProxy Configuration

OpsDash supports HAProxy 1.4 and above. Please refer the HAProxy documentation for all the options. Typically, the relevant parts of the configuration are something like this:

global
    stats socket /var/lib/haproxy/stats

listen stats
    bind 127.0.0.1:9999
    mode http
    stats enable
    stats uri /haproxy?stats
    stats auth myuser:mypass