Allow HAProxy stats to be pinned to one or more processes

When HAProxy is run in multi-process mode, the single stats page
shows metrics for one of the processes at a time, with a random
selection made on page reload.

Whilst a more complete solution may be to enable a stats page for
each process, this is a little cumbersome. This addition allows
the stats page to be pinned to one process, providing a partial
snapshot of the state of the instance.

Change-Id: Id9314e5b267aafeaf34c82874eb8bfe0713dfac3
This commit is contained in:
Andrew Bonney 2021-03-25 13:46:37 +00:00
parent 93ca84c825
commit 357daad5c8
2 changed files with 9 additions and 0 deletions

View File

@ -33,6 +33,9 @@ haproxy_stats_port: 1936
haproxy_username: admin
haproxy_stats_password: secrete
haproxy_stats_refresh_interval: 60
# Pin stats gathering to one or more processes when using 'nbproc' tuning
# For permitted options see https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#3.1-stats%20bind-process
# haproxy_stats_process: all
# Default haproxy backup nodes to empty list so this doesn't have to be
# defined for each service.

View File

@ -18,6 +18,9 @@ global
tune.ssl.lifetime {{ haproxy_tuning_params.ssl_lifetime | default('300') }}
{% endif %}
stats socket /var/run/haproxy.stat level admin mode 600
{% if haproxy_stats_process is defined %}
stats bind-process {{ haproxy_stats_process }}
{% endif %}
{% if haproxy_ssl | bool %}
ssl-default-bind-options {{ haproxy_ssl_bind_options }}
tune.ssl.default-dh-param {{haproxy_ssl_dh_param}}
@ -39,6 +42,9 @@ defaults
listen stats
bind {{ haproxy_stats_bind_address }}:{{ haproxy_stats_port }} {% if haproxy_ssl | bool %}ssl crt {{ haproxy_ssl_pem }} ciphers {{ haproxy_ssl_cipher_suite }}{% endif %}
{% if haproxy_stats_process is defined %}
bind-process {{ haproxy_stats_process }}
{% endif %}
mode http
stats enable
stats hide-version