From: Willy Tarreau Date: Fri, 8 Jan 2016 16:20:51 +0000 (+0100) Subject: REORG: stats: dump the socket stats via the generic function X-Git-Tag: v1.7-dev2~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fa9512f2b70f4d5bf65c20425b2a7479c9a3ac0c;p=thirdparty%2Fhaproxy.git REORG: stats: dump the socket stats via the generic function The code was simply moved as-is to the new function. There's no functional change. --- diff --git a/src/dumpstats.c b/src/dumpstats.c index 537c75f563..00c9bfeed7 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -3392,6 +3392,67 @@ static int stats_dump_fields_html(const struct field *stats, int admin, unsigned U2H(stats[ST_F_EREQ].u.u64), field_str(stats, ST_F_STATUS)); } + else if (stats[ST_F_TYPE].u.u32 == STATS_TYPE_SO) { + chunk_appendf(&trash, ""); + if (admin) { + /* Column sub-heading for Enable or Disable server */ + chunk_appendf(&trash, ""); + } + + chunk_appendf(&trash, + /* frontend name, listener name */ + "%s" + "%s" + "", + field_str(stats, ST_F_PXNAME), field_str(stats, ST_F_SVNAME), + (flags & ST_SHLGNDS)?"":"", + field_str(stats, ST_F_PXNAME), field_str(stats, ST_F_SVNAME), field_str(stats, ST_F_SVNAME)); + + if (flags & ST_SHLGNDS) { + chunk_appendf(&trash, "
"); + + if (isdigit(*field_str(stats, ST_F_ADDR))) + chunk_appendf(&trash, "IPv4: %s, ", field_str(stats, ST_F_ADDR)); + else if (*field_str(stats, ST_F_ADDR) == '[') + chunk_appendf(&trash, "IPv6: %s, ", field_str(stats, ST_F_ADDR)); + else if (*field_str(stats, ST_F_ADDR)) + chunk_appendf(&trash, "%s, ", field_str(stats, ST_F_ADDR)); + + /* id */ + chunk_appendf(&trash, "id: %d
", stats[ST_F_SID].u.u32); + } + + chunk_appendf(&trash, + /* queue */ + "%s" + /* sessions rate: current, max, limit */ + " " + /* sessions: current, max, limit, total, lbtot, lastsess */ + "%s%s%s" + "%s  " + /* bytes: in, out */ + "%s%s" + "", + (flags & ST_SHLGNDS)?"
":"", + U2H(stats[ST_F_SCUR].u.u32), U2H(stats[ST_F_SMAX].u.u32), U2H(stats[ST_F_SLIM].u.u32), + U2H(stats[ST_F_STOT].u.u64), U2H(stats[ST_F_BIN].u.u64), U2H(stats[ST_F_BOUT].u.u64)); + + chunk_appendf(&trash, + /* denied: req, resp */ + "%s%s" + /* errors: request, connect, response */ + "%s" + /* warnings: retries, redispatches */ + "" + /* server status: reflect listener status */ + "%s" + /* rest of server: nothing */ + "" + "", + U2H(stats[ST_F_DREQ].u.u64), U2H(stats[ST_F_DRESP].u.u64), + U2H(stats[ST_F_EREQ].u.u64), + field_str(stats, ST_F_STATUS)); + } return 1; } @@ -3522,64 +3583,10 @@ static int stats_dump_li_stats(struct stream_interface *si, struct proxy *px, st } if (appctx->ctx.stats.flags & STAT_FMT_HTML) { - chunk_appendf(&trash, ""); - if (px->cap & PR_CAP_BE && px->srv && (appctx->ctx.stats.flags & STAT_ADMIN)) { - /* Column sub-heading for Enable or Disable server */ - chunk_appendf(&trash, ""); - } - chunk_appendf(&trash, - /* frontend name, listener name */ - "%s" - "%s" - "", - field_str(stats, ST_F_PXNAME), field_str(stats, ST_F_SVNAME), - (flags & ST_SHLGNDS)?"":"", - field_str(stats, ST_F_PXNAME), field_str(stats, ST_F_SVNAME), field_str(stats, ST_F_SVNAME)); - - if (flags & ST_SHLGNDS) { - chunk_appendf(&trash, "
"); - - if (isdigit(*field_str(stats, ST_F_ADDR))) - chunk_appendf(&trash, "IPv4: %s, ", field_str(stats, ST_F_ADDR)); - else if (*field_str(stats, ST_F_ADDR) == '[') - chunk_appendf(&trash, "IPv6: %s, ", field_str(stats, ST_F_ADDR)); - else if (*field_str(stats, ST_F_ADDR)) - chunk_appendf(&trash, "%s, ", field_str(stats, ST_F_ADDR)); - - /* id */ - chunk_appendf(&trash, "id: %d
", stats[ST_F_SID].u.u32); - } - - chunk_appendf(&trash, - /* queue */ - "%s" - /* sessions rate: current, max, limit */ - " " - /* sessions: current, max, limit, total, lbtot, lastsess */ - "%s%s%s" - "%s  " - /* bytes: in, out */ - "%s%s" - "", - (flags & ST_SHLGNDS)?"
":"", - U2H(stats[ST_F_SCUR].u.u32), U2H(stats[ST_F_SMAX].u.u32), U2H(stats[ST_F_SLIM].u.u32), - U2H(stats[ST_F_STOT].u.u64), U2H(stats[ST_F_BIN].u.u64), U2H(stats[ST_F_BOUT].u.u64)); + int admin; - chunk_appendf(&trash, - /* denied: req, resp */ - "%s%s" - /* errors: request, connect, response */ - "%s" - /* warnings: retries, redispatches */ - "" - /* server status: reflect listener status */ - "%s" - /* rest of server: nothing */ - "" - "", - U2H(stats[ST_F_DREQ].u.u64), U2H(stats[ST_F_DRESP].u.u64), - U2H(stats[ST_F_EREQ].u.u64), - field_str(stats, ST_F_STATUS)); + admin = (px->cap & PR_CAP_BE) && px->srv && (appctx->ctx.stats.flags & STAT_ADMIN); + stats_dump_fields_html(stats, admin, flags, px); } else { /* CSV mode */ /* dump everything */