]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stats: fixing stat shows disabled frontend status as 'OPEN'
authorAurelien DARRAGON <adarragon@haproxy.com>
Fri, 9 Sep 2022 13:58:57 +0000 (15:58 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 9 Sep 2022 15:24:22 +0000 (17:24 +0200)
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

index fdbca006556a5d9d207f79164608b2aaa8c696c1..97e7fd865acd89949855987e9ee124619fc5889a 100644 (file)
@@ -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;