Monitoring HAProxy

Configure the Server Density agent to monitor your HAProxy balance to:

• Collect important metrics, such as performance, outages and utilisation
• Identify overall server slowdowns caused by the load balancer

Monitored metrics

  • haproxy.frontend.bytes.in_rate
  • haproxy.frontend.bytes.out_rate
  • haproxy.frontend.denied.req_rate
  • haproxy.frontend.denied.resp_rate
  • haproxy.frontend.errors.req_rate
  • haproxy.frontend.requests.rate
  • haproxy.frontend.response.1xx
  • haproxy.frontend.response.2xx
  • haproxy.frontend.response.3xx
  • haproxy.frontend.response.4xx
  • haproxy.frontend.response.5xx
  • haproxy.frontend.response.other
  • haproxy.frontend.session.current
  • haproxy.frontend.session.limit
  • haproxy.frontend.session.pct
  • haproxy.frontend.session.time
  • haproxy.backend.bytes.in_rate
  • haproxy.backend.bytes.out_rate
  • haproxy.backend.connect.time
  • haproxy.backend.denied.req_rate
  • haproxy.backend.denied.resp_rate
  • haproxy.backend.errors.con_rate
  • haproxy.backend.errors.resp_rate
  • haproxy.backend.queue.current
  • haproxy.backend.queue.time
  • haproxy.backend.response.1xx
  • haproxy.backend.response.2xx
  • haproxy.backend.response.3xx
  • haproxy.backend.response.4xx
  • haproxy.backend.response.5xx
  • haproxy.backend.response.other
  • haproxy.backend.response.time
  • haproxy.backend.session.current
  • haproxy.backend.session.limit
  • haproxy.backend.session.pct
  • haproxy.backend.session.rate
  • haproxy.backend.session.time
  • haproxy.backend.warnings.redis_rate
  • haproxy.backend.warnings.retr_rate

Installing the HAProxy plugin package

Install the HAProxy plugin on Debian/Ubuntu:

sudo apt-get install sd-agent-haproxy

Install the HAProxy plugin on RHEL/CentOS:

sudo yum install sd-agent-haproxy

Configuring the agent to monitor HAProxy

1. Configure /etc/sd-agent/conf.d/haproxy.yaml

init_config:

 instances: 
 - url: http://localhost/admin?stats
   #username: xxx  
   #password: xxx
   #collect_status_metrics: True
   #collect_status_metrics_by_host: True
  • If your status URL requires authentication uncomment the username and password options, adding your authentication details.
  • Host status metrics can be collected by uncommenting the collect_status_metrics and collect_status_metrics_by_host in the above example. These are set to false by default. 

2. Restart the agent

sudo /etc/init.d/sd-agent restart

Verifying the configuration
Execute info to verify the configuration with the following:

sudo /etc/init.d/sd-agent info 

If the agent has been configured correctly you’ll see an output such as:

haproxy
-----
  - instance #0 [OK]
  - Collected 39 metrics & 3 service checks

You can also check the metrics that the check is returning with the following command

sudo -u sd-agent /usr/share/python/sd-agent/agent.py check haproxy

Configuring graphs

Click the name of your server from the Devices list in your Server Density account then go to the Metrics tab. Click the + Graph button on the right then choose the HAProxy metrics to display the graphs. The metrics will also be available to select when building dashboard graphs.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Monday  —  Friday.

10am  —  6pm UK.

Dedicated Support.