From cddec0aef526f2dc64bad5a83ad788d60c12639c Mon Sep 17 00:00:00 2001 From: Aurelien DARRAGON Date: Fri, 9 Sep 2022 15:58:57 +0200 Subject: [PATCH] BUG/MINOR: stats: fixing stat shows disabled frontend status as 'OPEN' This patch adresses the issue #1626. Adding support for PR_FL_PAUSED flag in the function stats_fill_fe_stats(). The command 'show stat' now properly reports a disabled frontend using "PAUSED" state label. This patch depends on the following commits: - 7d00077fd5 "BUG/MEDIUM: proxy: ensure pause_proxy() and resume_proxy() own PROXY_LOCK". - 001328873c "MINOR: listener: small API change" - d46f437de6 "MINOR: proxy/listener: support for additional PAUSED state" It should be backported to 2.6, 2.5 and 2.4 --- src/stats.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/stats.c b/src/stats.c index fdbca0065..97e7fd865 100644 --- a/src/stats.c +++ b/src/stats.c @@ -1697,9 +1697,18 @@ int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len, case ST_F_DSES: metric = mkf_u64(FN_COUNTER, px->fe_counters.denied_sess); break; - case ST_F_STATUS: - metric = mkf_str(FO_STATUS, (px->flags & (PR_FL_DISABLED|PR_FL_STOPPED)) ? "STOP" : "OPEN"); + case ST_F_STATUS: { + const char *state; + + if (px->flags & (PR_FL_DISABLED|PR_FL_STOPPED)) + state = "STOP"; + else if (px->flags & PR_FL_PAUSED) + state = "PAUSED"; + else + state = "OPEN"; + metric = mkf_str(FO_STATUS, state); break; + } case ST_F_PID: metric = mkf_u32(FO_KEY, 1); break;