From: Amaury Denoyelle Date: Tue, 13 Jan 2026 15:24:52 +0000 (+0100) Subject: MINOR: stats: report BE unpublished status X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82907d5621bcea189dfb285540c04f0078bd8951;p=thirdparty%2Fhaproxy.git MINOR: stats: report BE unpublished status A previous patch defines a new proxy status : unpublished backends. This patch extends this by changing proxy status reported in stats. If unpublished is set, an extra "(UNPUB)" is added to the field. Also, HTML stats is also slightly updated. If a backend is up but unpublished, its status will be reported in orange color. --- diff --git a/src/stats-html.c b/src/stats-html.c index b18d64195..79ffc9731 100644 --- a/src/stats-html.c +++ b/src/stats-html.c @@ -1133,6 +1133,23 @@ int stats_dump_fields_html(struct buffer *out, chunk_appendf(out, "\n"); } else if (stats[ST_I_PX_TYPE].u.u32 == STATS_TYPE_BE) { + struct ist ist_status = ist(field_str(stats, ST_I_PX_STATUS)); + struct buffer buf_status; + char status[64]; + + buf_status = b_make(status, sizeof(status), 0, 0); + if (istmatch(ist_status, ist("DOWN"))) { + chunk_appendf(&buf_status, "%s", + "red", field_str(stats, ST_I_PX_STATUS)); + } + else if (istist(ist_status, ist("UNPUB")).len != 0) { + chunk_appendf(&buf_status, "%s", + "orange", field_str(stats, ST_I_PX_STATUS)); + } + else { + chunk_appendf(&buf_status, "%s", field_str(stats, ST_I_PX_STATUS)); + } + chunk_appendf(out, ""); if (flags & STAT_F_ADMIN) { /* Column sub-heading for Enable or Disable server */ @@ -1298,7 +1315,7 @@ int stats_dump_fields_html(struct buffer *out, (long long)stats[ST_I_PX_SRV_ABRT].u.u64, (long long)stats[ST_I_PX_WRETR].u.u64, (long long)stats[ST_I_PX_WREDIS].u.u64, human_time(stats[ST_I_PX_LASTCHG].u.u32, 1), - strcmp(field_str(stats, ST_I_PX_STATUS), "DOWN") ? field_str(stats, ST_I_PX_STATUS) : "DOWN", + status, stats[ST_I_PX_WEIGHT].u.u32, stats[ST_I_PX_UWEIGHT].u.u32, stats[ST_I_PX_ACT].u.u32, stats[ST_I_PX_BCK].u.u32); diff --git a/src/stats-proxy.c b/src/stats-proxy.c index 03b1999c0..8d15d7bdf 100644 --- a/src/stats-proxy.c +++ b/src/stats-proxy.c @@ -1262,6 +1262,8 @@ int stats_fill_be_line(struct proxy *px, int flags, struct field *line, int len, case ST_I_PX_STATUS: fld = chunk_newstr(out); chunk_appendf(out, "%s", (px->lbprm.tot_weight > 0 || !px->srv) ? "UP" : "DOWN"); + if (px->flags & PR_FL_BE_UNPUBLISHED) + chunk_appendf(out, " (UNPUB)"); if (flags & (STAT_F_HIDE_MAINT|STAT_F_HIDE_DOWN)) chunk_appendf(out, " (%d/%d)", nbup, nbsrv); field = mkf_str(FO_STATUS, fld);