[MINOR] add additional "a href"s to stats page

This patch adds <a href> html links for proxies, frontends, servers
and backends. Once located, can be clicked. Users no longer have to
manually add #anchor to stat's url.
This commit is contained in:
Krzysztof Piotr Oledzki 2009-10-24 14:24:30 +02:00 committed by Willy Tarreau
parent cc05fba613
commit 1f67285541

View File

@ -989,6 +989,13 @@ int stats_dump_http(struct session *s, struct buffer *rep, struct uri_auth *uri)
".backup6 {background: #e0e0e0;}\n" ".backup6 {background: #e0e0e0;}\n"
".rls {letter-spacing: 0.2em; margin-right: 1px;}\n" /* right letter spacing (used for grouping digits) */ ".rls {letter-spacing: 0.2em; margin-right: 1px;}\n" /* right letter spacing (used for grouping digits) */
"\n" "\n"
"a.px:link {color: #ffff40; text-decoration: none;}"
"a.px:visited {color: #ffff40; text-decoration: none;}"
"a.px:hover {color: #ffffff; text-decoration: none;}"
"a.lfsb:link {color: #000000; text-decoration: none;}"
"a.lfsb:visited {color: #000000; text-decoration: none;}"
"a.lfsb:hover {color: #505050; text-decoration: none;}"
"\n"
"table.tbl { border-collapse: collapse; border-style: none;}\n" "table.tbl { border-collapse: collapse; border-style: none;}\n"
"table.tbl td { text-align: right; border-width: 1px 1px 1px 1px; border-style: solid solid solid solid; padding: 2px 3px; border-color: gray; white-space: nowrap;}\n" "table.tbl td { text-align: right; border-width: 1px 1px 1px 1px; border-style: solid solid solid solid; padding: 2px 3px; border-color: gray; white-space: nowrap;}\n"
"table.tbl td.ac { text-align: center;}\n" "table.tbl td.ac { text-align: center;}\n"
@ -1224,7 +1231,9 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
chunk_printf(&msg, chunk_printf(&msg,
"<table class=\"tbl\" width=\"100%%\">\n" "<table class=\"tbl\" width=\"100%%\">\n"
"<tr class=\"titre\">" "<tr class=\"titre\">"
"<th class=\"pxname\" width=\"10%%\"><a name=\"%s\">%s</a></th>" "<th class=\"pxname\" width=\"10%%\">"
"<a name=\"%s\"></a>"
"<a class=px href=\"#%s\">%s</a></th>"
"<th class=\"%s\" width=\"90%%\">%s</th>" "<th class=\"%s\" width=\"90%%\">%s</th>"
"</tr>\n" "</tr>\n"
"</table>\n" "</table>\n"
@ -1247,7 +1256,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
"<th>Bck</th><th>Chk</th><th>Dwn</th><th>Dwntme</th>" "<th>Bck</th><th>Chk</th><th>Dwn</th><th>Dwntme</th>"
"<th>Thrtle</th>\n" "<th>Thrtle</th>\n"
"</tr>", "</tr>",
px->id, px->id, px->id, px->id, px->id,
px->desc ? "desc" : "empty", px->desc ? px->desc : ""); px->desc ? "desc" : "empty", px->desc ? px->desc : "");
if (buffer_feed_chunk(rep, &msg) >= 0) if (buffer_feed_chunk(rep, &msg) >= 0)
@ -1265,7 +1274,8 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
chunk_printf(&msg, chunk_printf(&msg,
/* name, queue */ /* name, queue */
"<tr class=\"frontend\"><td class=ac>" "<tr class=\"frontend\"><td class=ac>"
"<a name=\"%s/Frontend\">Frontend</a></td><td colspan=3></td>" "<a name=\"%s/Frontend\"></a>"
"<a class=lfsb href=\"#%s/Frontend\">Frontend</a></td><td colspan=3></td>"
/* sessions rate : current, max, limit */ /* sessions rate : current, max, limit */
"<td>%s</td><td>%s</td><td>%s</td>" "<td>%s</td><td>%s</td><td>%s</td>"
/* sessions : current, max, limit, total, lbtot */ /* sessions : current, max, limit, total, lbtot */
@ -1274,7 +1284,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
/* bytes : in, out */ /* bytes : in, out */
"<td>%s</td><td>%s</td>" "<td>%s</td><td>%s</td>"
"", "",
px->id, px->id, px->id,
U2H0(read_freq_ctr(&px->fe_sess_per_sec)), U2H0(read_freq_ctr(&px->fe_sess_per_sec)),
U2H1(px->counters.fe_sps_max), LIM2A2(px->fe_sps_lim, "-"), U2H1(px->counters.fe_sps_max), LIM2A2(px->fe_sps_lim, "-"),
U2H3(px->feconn), U2H4(px->counters.feconn_max), U2H5(px->maxconn), U2H3(px->feconn), U2H4(px->counters.feconn_max), U2H5(px->maxconn),
@ -1491,7 +1501,9 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
"<i>no check</i>" }; "<i>no check</i>" };
chunk_printf(&msg, chunk_printf(&msg,
/* name */ /* name */
"<tr class=\"%s%d\"><td class=ac><a name=\"%s/%s\">%s</a></td>" "<tr class=\"%s%d\"><td class=ac>"
"<a name=\"%s/%s\"></a>"
"<a class=lfsb href=\"#%s/%s\">%s</a></td>"
/* queue : current, max, limit */ /* queue : current, max, limit */
"<td>%s</td><td>%s</td><td>%s</td>" "<td>%s</td><td>%s</td><td>%s</td>"
/* sessions rate : current, max, limit */ /* sessions rate : current, max, limit */
@ -1501,7 +1513,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
"<td" "<td"
"", "",
(sv->state & SRV_BACKUP) ? "backup" : "active", (sv->state & SRV_BACKUP) ? "backup" : "active",
sv_state, px->id, sv->id, sv->id, sv_state, px->id, sv->id, px->id, sv->id, sv->id,
U2H0(sv->nbpend), U2H1(sv->counters.nbpend_max), LIM2A2(sv->maxqueue, "-"), U2H0(sv->nbpend), U2H1(sv->counters.nbpend_max), LIM2A2(sv->maxqueue, "-"),
U2H3(read_freq_ctr(&sv->sess_per_sec)), U2H4(sv->counters.sps_max), U2H3(read_freq_ctr(&sv->sess_per_sec)), U2H4(sv->counters.sps_max),
U2H5(sv->cur_sess), U2H6(sv->counters.cur_sess_max), LIM2A7(sv->maxconn, "-")); U2H5(sv->cur_sess), U2H6(sv->counters.cur_sess_max), LIM2A7(sv->maxconn, "-"));
@ -1749,13 +1761,14 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
chunk_printf(&msg, chunk_printf(&msg,
/* name */ /* name */
"<tr class=\"backend\"><td class=ac>" "<tr class=\"backend\"><td class=ac>"
"<a name=\"%s/Backend\">Backend</a></td>" "<a name=\"%s/Backend\"></a>"
"<a class=lfsb href=\"#%s/Backend\">Backend</a></td>"
/* queue : current, max */ /* queue : current, max */
"<td>%s</td><td>%s</td><td></td>" "<td>%s</td><td>%s</td><td></td>"
/* sessions rate : current, max, limit */ /* sessions rate : current, max, limit */
"<td>%s</td><td>%s</td><td></td>" "<td>%s</td><td>%s</td><td></td>"
"", "",
px->id, px->id, px->id,
U2H0(px->nbpend) /* or px->totpend ? */, U2H1(px->counters.nbpend_max), U2H0(px->nbpend) /* or px->totpend ? */, U2H1(px->counters.nbpend_max),
U2H2(read_freq_ctr(&px->be_sess_per_sec)), U2H3(px->counters.be_sps_max)); U2H2(read_freq_ctr(&px->be_sess_per_sec)), U2H3(px->counters.be_sps_max));