From: Willy Tarreau Date: Tue, 24 Jul 2007 22:28:06 +0000 (+0200) Subject: [MINOR] fix backend's weight in the stats page. X-Git-Tag: v1.3.13~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4b946c8564332836b9c2bfa540558f8a8895896f;p=thirdparty%2Fhaproxy.git [MINOR] fix backend's weight in the stats page. The GCD used when computing the servers' weights causes the total weight of the backend to appear lower than expected because it is divided by the GCD. Easy solution consists in recomputing the GCD from the first server and apply it to the global weight. --- diff --git a/src/proto_http.c b/src/proto_http.c index f717bdf326..10420818ce 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -3848,9 +3848,18 @@ int produce_content_stats_proxy(struct session *s, struct proxy *px) case DATA_ST_PX_BE: /* print the backend */ if (px->cap & PR_CAP_BE) { + int gcd = 1; + if (px->map_state & PR_MAP_RECALC) recalc_server_map(px); + /* The GCD which was computed causes the total effective + * weight to appear lower than all weights. Let's + * recompute it. + */ + if (px->srv && px->srv->eweight) + gcd = px->srv->uweight / px->srv->eweight; + chunk_printf(&msg, sizeof(trash), /* name */ "Backend" @@ -3879,7 +3888,7 @@ int produce_content_stats_proxy(struct session *s, struct proxy *px) px->denied_req, px->denied_resp, px->failed_conns, px->failed_resp, (px->srv_map_sz > 0 || !px->srv) ? "UP" : "DOWN", - px->srv_map_sz, px->srv_act, px->srv_bck); + px->srv_map_sz * gcd, px->srv_act, px->srv_bck); if (buffer_write_chunk(rep, &msg) != 0) return 0;