The state of servers that were put in maintenance via the runtime API are
reported within the "backend_agg_server_check_status" metric, which
lead to inconsistent sums when compared to the "haproxy_server_check_status"
metric.

Now excluding them from this computation.
---
 addons/promex/service-prometheus.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/addons/promex/service-prometheus.c 
b/addons/promex/service-prometheus.c
index e02e8c0c7..7b61683dd 100644
--- a/addons/promex/service-prometheus.c
+++ b/addons/promex/service-prometheus.c
@@ -863,9 +863,12 @@ static int promex_dump_back_metrics(struct appctx *appctx, 
struct htx *htx)
                                                goto next_px;
                                        sv = px->srv;
                                        while (sv) {
+                                               if (sv->cur_admin & 
SRV_ADMF_MAINT)
+                                                       goto next_sv;
                                                srv_check_status = 
sv->check.status;
                                                
srv_check_count[srv_check_status] += 1;
-                                               sv = sv->next;
+                                               next_sv:
+                                                       sv = sv->next;
                                        }
                                        for (; ctx->obj_state < 
HCHK_STATUS_SIZE; ctx->obj_state++) {
                                                if 
(get_check_status_result(ctx->obj_state) < CHK_RES_FAILED)
-- 
2.25.1

Reply via email to