Monitoring HAProxy - Configuring the HAProxy Stats page

Monitoring HAProxy - Configuring the HAProxy Stats page

To effectively monitor an HAProxy instance, you can enable and access the HAProxy stats page, which provides real-time metrics about HAProxy's performance.

Steps to Enable HAProxy Stats:
  • Open the HAProxy Configuration File: The HAProxy configuration file is usually located at /etc/haproxy/haproxy.cfg. Open it using a text editor.
  • Add the Stats Configuration: At the end of the haproxy.cfg file, add the following configuration to enable the stats page:
      For HAProxy version 1.9 and below
Quote
listen stats :9000
mode http
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /
stats auth Username:Password
      For HAProxy version 2.0 and above
Quote
listen stats
bind :9000
mode http
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /
stats auth Username:Password
  • Restart HAProxy: After making the changes, restart the HAProxy service to apply the new configuration. This will open up the stats in the port '9000' (we have specified 9000 as the port in the configuration).
  • You can further add the same HAProxy for monitoring using the hostname and port.

Notes
Notes:
  1. You can change the port (9000 by default) to any free port that you wish to use.
  2. The line number 7 is for setting up basic authentication for this stats url. A user can provide his own username and password
  3. We use the following URL to collect metrics: http://[HOSTNAME]:[PORT]/;csv
  4. Replace [HOSTNAME] and [PORT] with the respective hostname of the HAProxy instance and port which is mentioned in the above configuration.
  5. The above configuration will open the stats with no restrictions. To restrict the access only to Applications Manager, make the following changes in the configuration
            listen stats
            bind :9000
            mode http
            stats enable
            stats hide-version
            stats realm Haproxy\ Statistics
            stats uri /
            stats auth Username:Password
            acl allowed_ip src <ip_of_apm_installed_machine>
            http-request deny if !allowed_ip

                  New to ADSelfService Plus?

                    • Related Articles

                    • Troubleshooting - HAProxy

                      To troubleshoot HAProxy Monitor, follow the below steps: Verify Accessibility: Ensure that the HAProxy instance is accessible from the Applications Manager server. Check Host and Port: Make sure you’ve entered the correct host and port number for ...
                    • Self monitor Applications Manager using APM Insight Java Agent

                      Applications Manager is built with Java, hence we can monitor it using APM Insight Java Agent to measure it's performance continuously, which can be very much useful. Setting up APM Insight Java Agent Follow the below steps to download and set up the ...
                    • Uninstrumented Block of Code - APM Insight

                      In the traces tab --> Slowest Method Calls and Count we show if you find Un-instrumented block of code the reason is as follows: Basically, What is un-instrumented block of code in APM Insight? By default, APM Insight agent monitors known frameworks ...
                    • Troubleshooting Applications Manager Plugin database migration failure after service pack upgrade of OPM and APM plugin

                      When upgrading OpManager from version 12.6.xxx to 12.7.xxx and updating the APM Plugin to 1651x, particularly when using Postgresql as the backend database, an essential one-time migration occurs. This migration involves moving our backend Postgresql ...
                    • How to rename an existing APM - Java agent application's monitor?

                      In Applications Manager's APM(Application Performance Monitoring) doesn't support renaming applications/monitors from the web client. However, the application name of an existing application instance can be renamed in the `apminsight.conf` file and ...