mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-18 09:24:31 +00:00
MINOR: stats: use STAT_F_* prefix for flags
Some flags are defined during statistics generation and output. They use the prefix STAT_* which is also used for other purposes. Rename them with the new prefix STAT_F_* to differentiate them from the other usages.
This commit is contained in:
parent
e97375dcab
commit
341bf913d4
@ -26,29 +26,29 @@
|
||||
#include <haproxy/buf-t.h>
|
||||
|
||||
/* Flags for applet.ctx.stats.flags */
|
||||
#define STAT_FMT_HTML 0x00000001 /* dump the stats in HTML format */
|
||||
#define STAT_FMT_TYPED 0x00000002 /* use the typed output format */
|
||||
#define STAT_FMT_JSON 0x00000004 /* dump the stats in JSON format */
|
||||
#define STAT_HIDE_DOWN 0x00000008 /* hide 'down' servers in the stats page */
|
||||
#define STAT_NO_REFRESH 0x00000010 /* do not automatically refresh the stats page */
|
||||
#define STAT_ADMIN 0x00000020 /* indicate a stats admin level */
|
||||
#define STAT_CHUNKED 0x00000040 /* use chunked encoding (HTTP/1.1) */
|
||||
#define STAT_JSON_SCHM 0x00000080 /* dump the json schema */
|
||||
#define STAT_F_FMT_HTML 0x00000001 /* dump the stats in HTML format */
|
||||
#define STAT_F_FMT_TYPED 0x00000002 /* use the typed output format */
|
||||
#define STAT_F_FMT_JSON 0x00000004 /* dump the stats in JSON format */
|
||||
#define STAT_F_HIDE_DOWN 0x00000008 /* hide 'down' servers in the stats page */
|
||||
#define STAT_F_NO_REFRESH 0x00000010 /* do not automatically refresh the stats page */
|
||||
#define STAT_F_ADMIN 0x00000020 /* indicate a stats admin level */
|
||||
#define STAT_F_CHUNKED 0x00000040 /* use chunked encoding (HTTP/1.1) */
|
||||
#define STAT_F_JSON_SCHM 0x00000080 /* dump the json schema */
|
||||
|
||||
#define STAT_HIDEVER 0x00000100 /* conf: do not report the version and reldate */
|
||||
#define STAT_SHNODE 0x00000200 /* conf: show node name */
|
||||
#define STAT_SHDESC 0x00000400 /* conf: show description */
|
||||
#define STAT_SHLGNDS 0x00000800 /* conf: show legends */
|
||||
#define STAT_SHOW_FDESC 0x00001000 /* show the column descriptions when possible */
|
||||
#define STAT_SHMODULES 0x00002000 /* conf: show modules */
|
||||
#define STAT_HIDE_MAINT 0x00004000 /* hide maint/disabled servers */
|
||||
#define STAT_CONVDONE 0x00008000 /* conf: rules conversion done */
|
||||
#define STAT_USE_FLOAT 0x00010000 /* use floats where possible in the outputs */
|
||||
#define STAT_F_HIDEVER 0x00000100 /* conf: do not report the version and reldate */
|
||||
#define STAT_F_SHNODE 0x00000200 /* conf: show node name */
|
||||
#define STAT_F_SHDESC 0x00000400 /* conf: show description */
|
||||
#define STAT_F_SHLGNDS 0x00000800 /* conf: show legends */
|
||||
#define STAT_F_SHOW_FDESC 0x00001000 /* show the column descriptions when possible */
|
||||
#define STAT_F_SHMODULES 0x00002000 /* conf: show modules */
|
||||
#define STAT_F_HIDE_MAINT 0x00004000 /* hide maint/disabled servers */
|
||||
#define STAT_F_CONVDONE 0x00008000 /* conf: rules conversion done */
|
||||
#define STAT_F_USE_FLOAT 0x00010000 /* use floats where possible in the outputs */
|
||||
|
||||
#define STAT_BOUND 0x00800000 /* bound statistics to selected proxies/types/services */
|
||||
#define STAT_STARTED 0x01000000 /* some output has occurred */
|
||||
#define STAT_F_BOUND 0x00800000 /* bound statistics to selected proxies/types/services */
|
||||
#define STAT_F_STARTED 0x01000000 /* some output has occurred */
|
||||
|
||||
#define STAT_FMT_MASK 0x00000007
|
||||
#define STAT_F_FMT_MASK 0x00000007
|
||||
|
||||
#define STATS_TYPE_FE 0
|
||||
#define STATS_TYPE_BE 1
|
||||
@ -539,7 +539,7 @@ struct show_stat_ctx {
|
||||
int scope_len; /* length of the string above in the buffer */
|
||||
int field; /* current field iterator when stat line is dumped through returning function */
|
||||
int px_st; /* STAT_PX_ST* */
|
||||
unsigned int flags; /* STAT_* from stats-t.h */
|
||||
unsigned int flags; /* STAT_F_* from stats-t.h */
|
||||
int iid, type, sid; /* proxy id, type and service id if bounding of stats is enabled */
|
||||
int st_code; /* the status code returned by an action */
|
||||
struct buffer chunk; /* temporary buffer which holds a single-line output */
|
||||
|
@ -1819,13 +1819,13 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
||||
if (!stats_check_init_uri_auth(&curproxy->uri_auth))
|
||||
goto alloc_error;
|
||||
} else if (strcmp(args[1], "hide-version") == 0) {
|
||||
if (!stats_set_flag(&curproxy->uri_auth, STAT_HIDEVER))
|
||||
if (!stats_set_flag(&curproxy->uri_auth, STAT_F_HIDEVER))
|
||||
goto alloc_error;
|
||||
} else if (strcmp(args[1], "show-legends") == 0) {
|
||||
if (!stats_set_flag(&curproxy->uri_auth, STAT_SHLGNDS))
|
||||
if (!stats_set_flag(&curproxy->uri_auth, STAT_F_SHLGNDS))
|
||||
goto alloc_error;
|
||||
} else if (strcmp(args[1], "show-modules") == 0) {
|
||||
if (!stats_set_flag(&curproxy->uri_auth, STAT_SHMODULES))
|
||||
if (!stats_set_flag(&curproxy->uri_auth, STAT_F_SHMODULES))
|
||||
goto alloc_error;
|
||||
} else if (strcmp(args[1], "show-node") == 0) {
|
||||
|
||||
|
@ -3359,7 +3359,7 @@ init_proxies_list_stage1:
|
||||
}
|
||||
}
|
||||
|
||||
if (curproxy->uri_auth && !(curproxy->uri_auth->flags & STAT_CONVDONE) &&
|
||||
if (curproxy->uri_auth && !(curproxy->uri_auth->flags & STAT_F_CONVDONE) &&
|
||||
!LIST_ISEMPTY(&curproxy->uri_auth->http_req_rules) &&
|
||||
(curproxy->uri_auth->userlist || curproxy->uri_auth->auth_realm )) {
|
||||
ha_alert("%s '%s': stats 'auth'/'realm' and 'http-request' can't be used at the same time.\n",
|
||||
@ -3369,7 +3369,7 @@ init_proxies_list_stage1:
|
||||
}
|
||||
|
||||
if (curproxy->uri_auth && curproxy->uri_auth->userlist &&
|
||||
(!(curproxy->uri_auth->flags & STAT_CONVDONE) ||
|
||||
(!(curproxy->uri_auth->flags & STAT_F_CONVDONE) ||
|
||||
LIST_ISEMPTY(&curproxy->uri_auth->http_req_rules))) {
|
||||
const char *uri_auth_compat_req[10];
|
||||
struct act_rule *rule;
|
||||
@ -3400,7 +3400,7 @@ init_proxies_list_stage1:
|
||||
if (curproxy->uri_auth->auth_realm) {
|
||||
ha_free(&curproxy->uri_auth->auth_realm);
|
||||
}
|
||||
curproxy->uri_auth->flags |= STAT_CONVDONE;
|
||||
curproxy->uri_auth->flags |= STAT_F_CONVDONE;
|
||||
}
|
||||
out_uri_auth_compat:
|
||||
|
||||
|
@ -1158,7 +1158,7 @@ int hlua_listener_get_stats(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
stats_fill_li_line(li->bind_conf->frontend, li, STAT_SHLGNDS, stats,
|
||||
stats_fill_li_line(li->bind_conf->frontend, li, STAT_F_SHLGNDS, stats,
|
||||
STATS_LEN, NULL);
|
||||
|
||||
lua_newtable(L);
|
||||
@ -1204,7 +1204,7 @@ int hlua_server_get_stats(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
stats_fill_sv_line(srv->proxy, srv, STAT_SHLGNDS, stats,
|
||||
stats_fill_sv_line(srv->proxy, srv, STAT_F_SHLGNDS, stats,
|
||||
STATS_LEN, NULL);
|
||||
|
||||
lua_newtable(L);
|
||||
@ -2052,7 +2052,7 @@ int hlua_proxy_get_stats(lua_State *L)
|
||||
|
||||
px = hlua_check_proxy(L, 1);
|
||||
if (px->cap & PR_CAP_BE)
|
||||
stats_fill_be_line(px, STAT_SHLGNDS, stats, STATS_LEN, NULL);
|
||||
stats_fill_be_line(px, STAT_F_SHLGNDS, stats, STATS_LEN, NULL);
|
||||
else
|
||||
stats_fill_fe_line(px, stats, STATS_LEN, NULL);
|
||||
lua_newtable(L);
|
||||
|
@ -3878,9 +3878,9 @@ static int http_handle_stats(struct stream *s, struct channel *req, struct proxy
|
||||
ctx->st_code = STAT_STATUS_INIT;
|
||||
ctx->http_px = px;
|
||||
ctx->flags |= uri_auth->flags;
|
||||
ctx->flags |= STAT_FMT_HTML; /* assume HTML mode by default */
|
||||
ctx->flags |= STAT_F_FMT_HTML; /* assume HTML mode by default */
|
||||
if ((msg->flags & HTTP_MSGF_VER_11) && (txn->meth != HTTP_METH_HEAD))
|
||||
ctx->flags |= STAT_CHUNKED;
|
||||
ctx->flags |= STAT_F_CHUNKED;
|
||||
|
||||
htx = htxbuf(&req->buf);
|
||||
sl = http_get_stline(htx);
|
||||
@ -3889,14 +3889,14 @@ static int http_handle_stats(struct stream *s, struct channel *req, struct proxy
|
||||
|
||||
for (h = lookup; h <= end - 3; h++) {
|
||||
if (memcmp(h, ";up", 3) == 0) {
|
||||
ctx->flags |= STAT_HIDE_DOWN;
|
||||
ctx->flags |= STAT_F_HIDE_DOWN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (h = lookup; h <= end - 9; h++) {
|
||||
if (memcmp(h, ";no-maint", 9) == 0) {
|
||||
ctx->flags |= STAT_HIDE_MAINT;
|
||||
ctx->flags |= STAT_F_HIDE_MAINT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -3904,7 +3904,7 @@ static int http_handle_stats(struct stream *s, struct channel *req, struct proxy
|
||||
if (uri_auth->refresh) {
|
||||
for (h = lookup; h <= end - 10; h++) {
|
||||
if (memcmp(h, ";norefresh", 10) == 0) {
|
||||
ctx->flags |= STAT_NO_REFRESH;
|
||||
ctx->flags |= STAT_F_NO_REFRESH;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -3912,31 +3912,31 @@ static int http_handle_stats(struct stream *s, struct channel *req, struct proxy
|
||||
|
||||
for (h = lookup; h <= end - 4; h++) {
|
||||
if (memcmp(h, ";csv", 4) == 0) {
|
||||
ctx->flags &= ~(STAT_FMT_MASK|STAT_JSON_SCHM);
|
||||
ctx->flags &= ~(STAT_F_FMT_MASK|STAT_F_JSON_SCHM);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (h = lookup; h <= end - 6; h++) {
|
||||
if (memcmp(h, ";typed", 6) == 0) {
|
||||
ctx->flags &= ~(STAT_FMT_MASK|STAT_JSON_SCHM);
|
||||
ctx->flags |= STAT_FMT_TYPED;
|
||||
ctx->flags &= ~(STAT_F_FMT_MASK|STAT_F_JSON_SCHM);
|
||||
ctx->flags |= STAT_F_FMT_TYPED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (h = lookup; h <= end - 5; h++) {
|
||||
if (memcmp(h, ";json", 5) == 0) {
|
||||
ctx->flags &= ~(STAT_FMT_MASK|STAT_JSON_SCHM);
|
||||
ctx->flags |= STAT_FMT_JSON;
|
||||
ctx->flags &= ~(STAT_F_FMT_MASK|STAT_F_JSON_SCHM);
|
||||
ctx->flags |= STAT_F_FMT_JSON;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (h = lookup; h <= end - 12; h++) {
|
||||
if (memcmp(h, ";json-schema", 12) == 0) {
|
||||
ctx->flags &= ~STAT_FMT_MASK;
|
||||
ctx->flags |= STAT_JSON_SCHM;
|
||||
ctx->flags &= ~STAT_F_FMT_MASK;
|
||||
ctx->flags |= STAT_F_JSON_SCHM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -4005,7 +4005,7 @@ static int http_handle_stats(struct stream *s, struct channel *req, struct proxy
|
||||
|
||||
if (ret) {
|
||||
/* no rule, or the rule matches */
|
||||
ctx->flags |= STAT_ADMIN;
|
||||
ctx->flags |= STAT_F_ADMIN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -4013,21 +4013,21 @@ static int http_handle_stats(struct stream *s, struct channel *req, struct proxy
|
||||
if (txn->meth == HTTP_METH_GET || txn->meth == HTTP_METH_HEAD)
|
||||
appctx->st0 = STAT_HTTP_HEAD;
|
||||
else if (txn->meth == HTTP_METH_POST) {
|
||||
if (ctx->flags & STAT_ADMIN) {
|
||||
if (ctx->flags & STAT_F_ADMIN) {
|
||||
appctx->st0 = STAT_HTTP_POST;
|
||||
if (msg->msg_state < HTTP_MSG_DATA)
|
||||
req->analysers |= AN_REQ_HTTP_BODY;
|
||||
}
|
||||
else {
|
||||
/* POST without admin level */
|
||||
ctx->flags &= ~STAT_CHUNKED;
|
||||
ctx->flags &= ~STAT_F_CHUNKED;
|
||||
ctx->st_code = STAT_STATUS_DENY;
|
||||
appctx->st0 = STAT_HTTP_LAST;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Unsupported method */
|
||||
ctx->flags &= ~STAT_CHUNKED;
|
||||
ctx->flags &= ~STAT_F_CHUNKED;
|
||||
ctx->st_code = STAT_STATUS_IVAL;
|
||||
appctx->st0 = STAT_HTTP_LAST;
|
||||
}
|
||||
|
130
src/stats-html.c
130
src/stats-html.c
@ -213,8 +213,8 @@ void stats_dump_html_head(struct appctx *appctx)
|
||||
"}\n"
|
||||
"-->\n"
|
||||
"</style></head>\n",
|
||||
(ctx->flags & STAT_SHNODE) ? " on " : "",
|
||||
(ctx->flags & STAT_SHNODE) ? (uri && uri->node ? uri->node : global.node) : ""
|
||||
(ctx->flags & STAT_F_SHNODE) ? " on " : "",
|
||||
(ctx->flags & STAT_F_SHNODE) ? (uri && uri->node ? uri->node : global.node) : ""
|
||||
);
|
||||
}
|
||||
|
||||
@ -290,11 +290,11 @@ void stats_dump_html_info(struct stconn *sc)
|
||||
"<td align=\"left\" valign=\"top\" nowrap width=\"1%%\">"
|
||||
"<b>Display option:</b><ul style=\"margin-top: 0.25em;\">"
|
||||
"",
|
||||
(ctx->flags & STAT_HIDEVER) ? "" : (stats_version_string),
|
||||
pid, (ctx->flags & STAT_SHNODE) ? " on " : "",
|
||||
(ctx->flags & STAT_SHNODE) ? (uri->node ? uri->node : global.node) : "",
|
||||
(ctx->flags & STAT_SHDESC) ? ": " : "",
|
||||
(ctx->flags & STAT_SHDESC) ? (uri->desc ? uri->desc : global.desc) : "",
|
||||
(ctx->flags & STAT_F_HIDEVER) ? "" : (stats_version_string),
|
||||
pid, (ctx->flags & STAT_F_SHNODE) ? " on " : "",
|
||||
(ctx->flags & STAT_F_SHNODE) ? (uri->node ? uri->node : global.node) : "",
|
||||
(ctx->flags & STAT_F_SHDESC) ? ": " : "",
|
||||
(ctx->flags & STAT_F_SHDESC) ? (uri->desc ? uri->desc : global.desc) : "",
|
||||
pid, 1, 1, global.nbthread,
|
||||
up / 86400, (up % 86400) / 3600,
|
||||
(up % 3600) / 60, (up % 60),
|
||||
@ -325,34 +325,34 @@ void stats_dump_html_info(struct stconn *sc)
|
||||
scope_txt[strlen(STAT_SCOPE_PATTERN) + ctx->scope_len] = 0;
|
||||
}
|
||||
|
||||
if (ctx->flags & STAT_HIDE_DOWN)
|
||||
if (ctx->flags & STAT_F_HIDE_DOWN)
|
||||
chunk_appendf(chk,
|
||||
"<li><a href=\"%s%s%s%s\">Show all servers</a><br>\n",
|
||||
uri->uri_prefix,
|
||||
"",
|
||||
(ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
|
||||
(ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
|
||||
scope_txt);
|
||||
else
|
||||
chunk_appendf(chk,
|
||||
"<li><a href=\"%s%s%s%s\">Hide 'DOWN' servers</a><br>\n",
|
||||
uri->uri_prefix,
|
||||
";up",
|
||||
(ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
|
||||
(ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
|
||||
scope_txt);
|
||||
|
||||
if (uri->refresh > 0) {
|
||||
if (ctx->flags & STAT_NO_REFRESH)
|
||||
if (ctx->flags & STAT_F_NO_REFRESH)
|
||||
chunk_appendf(chk,
|
||||
"<li><a href=\"%s%s%s%s\">Enable refresh</a><br>\n",
|
||||
uri->uri_prefix,
|
||||
(ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
|
||||
"",
|
||||
scope_txt);
|
||||
else
|
||||
chunk_appendf(chk,
|
||||
"<li><a href=\"%s%s%s%s\">Disable refresh</a><br>\n",
|
||||
uri->uri_prefix,
|
||||
(ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
|
||||
";norefresh",
|
||||
scope_txt);
|
||||
}
|
||||
@ -360,8 +360,8 @@ void stats_dump_html_info(struct stconn *sc)
|
||||
chunk_appendf(chk,
|
||||
"<li><a href=\"%s%s%s%s\">Refresh now</a><br>\n",
|
||||
uri->uri_prefix,
|
||||
(ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
|
||||
(ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
|
||||
scope_txt);
|
||||
|
||||
chunk_appendf(chk,
|
||||
@ -397,8 +397,8 @@ void stats_dump_html_info(struct stconn *sc)
|
||||
"<a class=lfsb href=\"%s%s%s%s\" title=\"Remove this message\">[X]</a> "
|
||||
"Action processed successfully."
|
||||
"</div>\n", uri->uri_prefix,
|
||||
(ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
|
||||
(ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
|
||||
scope_txt);
|
||||
break;
|
||||
case STAT_STATUS_NONE:
|
||||
@ -407,8 +407,8 @@ void stats_dump_html_info(struct stconn *sc)
|
||||
"<a class=lfsb href=\"%s%s%s%s\" title=\"Remove this message\">[X]</a> "
|
||||
"Nothing has changed."
|
||||
"</div>\n", uri->uri_prefix,
|
||||
(ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
|
||||
(ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
|
||||
scope_txt);
|
||||
break;
|
||||
case STAT_STATUS_PART:
|
||||
@ -418,8 +418,8 @@ void stats_dump_html_info(struct stconn *sc)
|
||||
"Action partially processed.<br>"
|
||||
"Some server names are probably unknown or ambiguous (duplicated names in the backend)."
|
||||
"</div>\n", uri->uri_prefix,
|
||||
(ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
|
||||
(ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
|
||||
scope_txt);
|
||||
break;
|
||||
case STAT_STATUS_ERRP:
|
||||
@ -434,8 +434,8 @@ void stats_dump_html_info(struct stconn *sc)
|
||||
"<li>Some server names are probably unknown or ambiguous (duplicated names in the backend).</li>"
|
||||
"</ul>"
|
||||
"</div>\n", uri->uri_prefix,
|
||||
(ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
|
||||
(ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
|
||||
scope_txt);
|
||||
break;
|
||||
case STAT_STATUS_EXCD:
|
||||
@ -445,8 +445,8 @@ void stats_dump_html_info(struct stconn *sc)
|
||||
"<b>Action not processed : the buffer couldn't store all the data.<br>"
|
||||
"You should retry with less servers at a time.</b>"
|
||||
"</div>\n", uri->uri_prefix,
|
||||
(ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
|
||||
(ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
|
||||
scope_txt);
|
||||
break;
|
||||
case STAT_STATUS_DENY:
|
||||
@ -455,8 +455,8 @@ void stats_dump_html_info(struct stconn *sc)
|
||||
"<a class=lfsb href=\"%s%s%s%s\" title=\"Remove this message\">[X]</a> "
|
||||
"<b>Action denied.</b>"
|
||||
"</div>\n", uri->uri_prefix,
|
||||
(ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
|
||||
(ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
|
||||
scope_txt);
|
||||
break;
|
||||
case STAT_STATUS_IVAL:
|
||||
@ -465,8 +465,8 @@ void stats_dump_html_info(struct stconn *sc)
|
||||
"<a class=lfsb href=\"%s%s%s%s\" title=\"Remove this message\">[X]</a> "
|
||||
"<b>Invalid requests (unsupported method or chunked encoded request).</b>"
|
||||
"</div>\n", uri->uri_prefix,
|
||||
(ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
|
||||
(ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
|
||||
scope_txt);
|
||||
break;
|
||||
default:
|
||||
@ -475,8 +475,8 @@ void stats_dump_html_info(struct stconn *sc)
|
||||
"<a class=lfsb href=\"%s%s%s%s\" title=\"Remove this message\">[X]</a> "
|
||||
"Unexpected result."
|
||||
"</div>\n", uri->uri_prefix,
|
||||
(ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
|
||||
(ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
|
||||
scope_txt);
|
||||
}
|
||||
chunk_appendf(chk, "<p>\n");
|
||||
@ -484,9 +484,9 @@ void stats_dump_html_info(struct stconn *sc)
|
||||
}
|
||||
|
||||
/* Dump all fields from <stats> into <out> using the HTML format. A column is
|
||||
* reserved for the checkbox is STAT_ADMIN is set in <flags>. Some extra info
|
||||
* are provided if STAT_SHLGNDS is present in <flags>. The statistics from
|
||||
* extra modules are displayed at the end of the lines if STAT_SHMODULES is
|
||||
* reserved for the checkbox is STAT_F_ADMIN is set in <flags>. Some extra info
|
||||
* are provided if STAT_F_SHLGNDS is present in <flags>. The statistics from
|
||||
* extra modules are displayed at the end of the lines if STAT_F_SHMODULES is
|
||||
* present in <flags>.
|
||||
*/
|
||||
int stats_dump_fields_html(struct buffer *out,
|
||||
@ -503,7 +503,7 @@ int stats_dump_fields_html(struct buffer *out,
|
||||
/* name, queue */
|
||||
"<tr class=\"frontend\">");
|
||||
|
||||
if (flags & STAT_ADMIN) {
|
||||
if (flags & STAT_F_ADMIN) {
|
||||
/* Column sub-heading for Enable or Disable server */
|
||||
chunk_appendf(out, "<td></td>");
|
||||
}
|
||||
@ -668,7 +668,7 @@ int stats_dump_fields_html(struct buffer *out,
|
||||
U2H(stats[ST_I_PX_EREQ].u.u64),
|
||||
field_str(stats, ST_I_PX_STATUS));
|
||||
|
||||
if (flags & STAT_SHMODULES) {
|
||||
if (flags & STAT_F_SHMODULES) {
|
||||
list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
|
||||
chunk_appendf(out, "<td>");
|
||||
|
||||
@ -695,7 +695,7 @@ int stats_dump_fields_html(struct buffer *out,
|
||||
}
|
||||
else if (stats[ST_I_PX_TYPE].u.u32 == STATS_TYPE_SO) {
|
||||
chunk_appendf(out, "<tr class=socket>");
|
||||
if (flags & STAT_ADMIN) {
|
||||
if (flags & STAT_F_ADMIN) {
|
||||
/* Column sub-heading for Enable or Disable server */
|
||||
chunk_appendf(out, "<td></td>");
|
||||
}
|
||||
@ -706,10 +706,10 @@ int stats_dump_fields_html(struct buffer *out,
|
||||
"<a class=lfsb href=\"#%s/+%s\">%s</a>"
|
||||
"",
|
||||
field_str(stats, ST_I_PX_PXNAME), field_str(stats, ST_I_PX_SVNAME),
|
||||
(flags & STAT_SHLGNDS)?"<u>":"",
|
||||
(flags & STAT_F_SHLGNDS)?"<u>":"",
|
||||
field_str(stats, ST_I_PX_PXNAME), field_str(stats, ST_I_PX_SVNAME), field_str(stats, ST_I_PX_SVNAME));
|
||||
|
||||
if (flags & STAT_SHLGNDS) {
|
||||
if (flags & STAT_F_SHLGNDS) {
|
||||
chunk_appendf(out, "<div class=tips>");
|
||||
|
||||
if (isdigit((unsigned char)*field_str(stats, ST_I_PX_ADDR)))
|
||||
@ -736,7 +736,7 @@ int stats_dump_fields_html(struct buffer *out,
|
||||
/* bytes: in, out */
|
||||
"<td>%s</td><td>%s</td>"
|
||||
"",
|
||||
(flags & STAT_SHLGNDS)?"</u>":"",
|
||||
(flags & STAT_F_SHLGNDS)?"</u>":"",
|
||||
U2H(stats[ST_I_PX_SCUR].u.u32), U2H(stats[ST_I_PX_SMAX].u.u32), U2H(stats[ST_I_PX_SLIM].u.u32),
|
||||
U2H(stats[ST_I_PX_STOT].u.u64), U2H(stats[ST_I_PX_BIN].u.u64), U2H(stats[ST_I_PX_BOUT].u.u64));
|
||||
|
||||
@ -756,7 +756,7 @@ int stats_dump_fields_html(struct buffer *out,
|
||||
U2H(stats[ST_I_PX_EREQ].u.u64),
|
||||
field_str(stats, ST_I_PX_STATUS));
|
||||
|
||||
if (flags & STAT_SHMODULES) {
|
||||
if (flags & STAT_F_SHMODULES) {
|
||||
list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
|
||||
chunk_appendf(out, "<td>");
|
||||
|
||||
@ -830,7 +830,7 @@ int stats_dump_fields_html(struct buffer *out,
|
||||
(stats[ST_I_PX_BCK].u.u32) ? "backup" : "active", style);
|
||||
|
||||
|
||||
if (flags & STAT_ADMIN)
|
||||
if (flags & STAT_F_ADMIN)
|
||||
chunk_appendf(out,
|
||||
"<td><input class='%s-checkbox' type=\"checkbox\" name=\"s\" value=\"%s\"></td>",
|
||||
field_str(stats, ST_I_PX_PXNAME),
|
||||
@ -841,10 +841,10 @@ int stats_dump_fields_html(struct buffer *out,
|
||||
"<a class=lfsb href=\"#%s/%s\">%s</a>"
|
||||
"",
|
||||
field_str(stats, ST_I_PX_PXNAME), field_str(stats, ST_I_PX_SVNAME),
|
||||
(flags & STAT_SHLGNDS) ? "<u>" : "",
|
||||
(flags & STAT_F_SHLGNDS) ? "<u>" : "",
|
||||
field_str(stats, ST_I_PX_PXNAME), field_str(stats, ST_I_PX_SVNAME), field_str(stats, ST_I_PX_SVNAME));
|
||||
|
||||
if (flags & STAT_SHLGNDS) {
|
||||
if (flags & STAT_F_SHLGNDS) {
|
||||
chunk_appendf(out, "<div class=tips>");
|
||||
|
||||
if (isdigit((unsigned char)*field_str(stats, ST_I_PX_ADDR)))
|
||||
@ -874,7 +874,7 @@ int stats_dump_fields_html(struct buffer *out,
|
||||
/* sessions rate : current, max, limit */
|
||||
"<td>%s</td><td>%s</td><td></td>"
|
||||
"",
|
||||
(flags & STAT_SHLGNDS) ? "</u>" : "",
|
||||
(flags & STAT_F_SHLGNDS) ? "</u>" : "",
|
||||
U2H(stats[ST_I_PX_QCUR].u.u32), U2H(stats[ST_I_PX_QMAX].u.u32), LIM2A(stats[ST_I_PX_QLIMIT].u.u32, "-"),
|
||||
U2H(stats[ST_I_PX_RATE].u.u32), U2H(stats[ST_I_PX_RATE_MAX].u.u32));
|
||||
|
||||
@ -1096,7 +1096,7 @@ int stats_dump_fields_html(struct buffer *out,
|
||||
else
|
||||
chunk_appendf(out, "<td class=ac>-</td>");
|
||||
|
||||
if (flags & STAT_SHMODULES) {
|
||||
if (flags & STAT_F_SHMODULES) {
|
||||
list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
|
||||
chunk_appendf(out, "<td>");
|
||||
|
||||
@ -1123,7 +1123,7 @@ int stats_dump_fields_html(struct buffer *out,
|
||||
}
|
||||
else if (stats[ST_I_PX_TYPE].u.u32 == STATS_TYPE_BE) {
|
||||
chunk_appendf(out, "<tr class=\"backend\">");
|
||||
if (flags & STAT_ADMIN) {
|
||||
if (flags & STAT_F_ADMIN) {
|
||||
/* Column sub-heading for Enable or Disable server */
|
||||
chunk_appendf(out, "<td></td>");
|
||||
}
|
||||
@ -1133,10 +1133,10 @@ int stats_dump_fields_html(struct buffer *out,
|
||||
"%s<a name=\"%s/Backend\"></a>"
|
||||
"<a class=lfsb href=\"#%s/Backend\">Backend</a>"
|
||||
"",
|
||||
(flags & STAT_SHLGNDS)?"<u>":"",
|
||||
(flags & STAT_F_SHLGNDS)?"<u>":"",
|
||||
field_str(stats, ST_I_PX_PXNAME), field_str(stats, ST_I_PX_PXNAME));
|
||||
|
||||
if (flags & STAT_SHLGNDS) {
|
||||
if (flags & STAT_F_SHLGNDS) {
|
||||
/* balancing */
|
||||
chunk_appendf(out, "<div class=tips>balancing: %s",
|
||||
field_str(stats, ST_I_PX_ALGO));
|
||||
@ -1158,7 +1158,7 @@ int stats_dump_fields_html(struct buffer *out,
|
||||
/* sessions rate : current, max, limit */
|
||||
"<td>%s</td><td>%s</td><td></td>"
|
||||
"",
|
||||
(flags & STAT_SHLGNDS)?"</u>":"",
|
||||
(flags & STAT_F_SHLGNDS)?"</u>":"",
|
||||
U2H(stats[ST_I_PX_QCUR].u.u32), U2H(stats[ST_I_PX_QMAX].u.u32),
|
||||
U2H(stats[ST_I_PX_RATE].u.u32), U2H(stats[ST_I_PX_RATE_MAX].u.u32));
|
||||
|
||||
@ -1289,7 +1289,7 @@ int stats_dump_fields_html(struct buffer *out,
|
||||
stats[ST_I_PX_CHKDOWN].u.u32,
|
||||
stats[ST_I_PX_DOWNTIME].type ? human_time(stats[ST_I_PX_DOWNTIME].u.u32, 1) : " ");
|
||||
|
||||
if (flags & STAT_SHMODULES) {
|
||||
if (flags & STAT_F_SHMODULES) {
|
||||
list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
|
||||
chunk_appendf(out, "<td>");
|
||||
|
||||
@ -1331,7 +1331,7 @@ void stats_dump_html_px_hdr(struct stconn *sc, struct proxy *px)
|
||||
struct stats_module *mod;
|
||||
int stats_module_len = 0;
|
||||
|
||||
if (px->cap & PR_CAP_BE && px->srv && (ctx->flags & STAT_ADMIN)) {
|
||||
if (px->cap & PR_CAP_BE && px->srv && (ctx->flags & STAT_F_ADMIN)) {
|
||||
/* A form to enable/disable this proxy servers */
|
||||
|
||||
/* scope_txt = search pattern + search query, ctx->scope_len is always <= STAT_SCOPE_TXT_MAXLEN */
|
||||
@ -1358,10 +1358,10 @@ void stats_dump_html_px_hdr(struct stconn *sc, struct proxy *px)
|
||||
"<a name=\"%s\"></a>%s"
|
||||
"<a class=px href=\"#%s\">%s</a>",
|
||||
px->id,
|
||||
(ctx->flags & STAT_SHLGNDS) ? "<u>":"",
|
||||
(ctx->flags & STAT_F_SHLGNDS) ? "<u>":"",
|
||||
px->id, px->id);
|
||||
|
||||
if (ctx->flags & STAT_SHLGNDS) {
|
||||
if (ctx->flags & STAT_F_SHLGNDS) {
|
||||
/* cap, mode, id */
|
||||
chunk_appendf(chk, "<div class=tips>cap: %s, mode: %s, id: %d",
|
||||
proxy_cap_str(px->cap), proxy_mode_str(px->mode),
|
||||
@ -1376,10 +1376,10 @@ void stats_dump_html_px_hdr(struct stconn *sc, struct proxy *px)
|
||||
"</table>\n"
|
||||
"<table class=\"tbl\" width=\"100%%\">\n"
|
||||
"<tr class=\"titre\">",
|
||||
(ctx->flags & STAT_SHLGNDS) ? "</u>":"",
|
||||
(ctx->flags & STAT_F_SHLGNDS) ? "</u>":"",
|
||||
px->desc ? "desc" : "empty", px->desc ? px->desc : "");
|
||||
|
||||
if (ctx->flags & STAT_ADMIN) {
|
||||
if (ctx->flags & STAT_F_ADMIN) {
|
||||
/* Column heading for Enable or Disable server */
|
||||
if ((px->cap & PR_CAP_BE) && px->srv)
|
||||
chunk_appendf(chk,
|
||||
@ -1400,7 +1400,7 @@ void stats_dump_html_px_hdr(struct stconn *sc, struct proxy *px)
|
||||
"<th colspan=3>Errors</th><th colspan=2>Warnings</th>"
|
||||
"<th colspan=9>Server</th>");
|
||||
|
||||
if (ctx->flags & STAT_SHMODULES) {
|
||||
if (ctx->flags & STAT_F_SHMODULES) {
|
||||
// calculate the count of module for colspan attribute
|
||||
list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
|
||||
++stats_module_len;
|
||||
@ -1421,7 +1421,7 @@ void stats_dump_html_px_hdr(struct stconn *sc, struct proxy *px)
|
||||
"<th>Bck</th><th>Chk</th><th>Dwn</th><th>Dwntme</th>"
|
||||
"<th>Thrtle</th>\n");
|
||||
|
||||
if (ctx->flags & STAT_SHMODULES) {
|
||||
if (ctx->flags & STAT_F_SHMODULES) {
|
||||
list_for_each_entry(mod, &stats_module_list[STATS_DOMAIN_PROXY], list) {
|
||||
chunk_appendf(chk, "<th>%s</th>", mod->name);
|
||||
}
|
||||
@ -1442,7 +1442,7 @@ void stats_dump_html_px_end(struct stconn *sc, struct proxy *px)
|
||||
|
||||
chunk_appendf(chk, "</table>");
|
||||
|
||||
if ((px->cap & PR_CAP_BE) && px->srv && (ctx->flags & STAT_ADMIN)) {
|
||||
if ((px->cap & PR_CAP_BE) && px->srv && (ctx->flags & STAT_F_ADMIN)) {
|
||||
/* close the form used to enable/disable this proxy servers */
|
||||
chunk_appendf(chk,
|
||||
"Choose the action to perform on the checked servers : "
|
||||
@ -1499,11 +1499,11 @@ static int stats_send_http_headers(struct stconn *sc, struct htx *htx)
|
||||
|
||||
if (!htx_add_header(htx, ist("Cache-Control"), ist("no-cache")))
|
||||
goto full;
|
||||
if (ctx->flags & STAT_FMT_HTML) {
|
||||
if (ctx->flags & STAT_F_FMT_HTML) {
|
||||
if (!htx_add_header(htx, ist("Content-Type"), ist("text/html")))
|
||||
goto full;
|
||||
}
|
||||
else if (ctx->flags & (STAT_FMT_JSON|STAT_JSON_SCHM)) {
|
||||
else if (ctx->flags & (STAT_F_FMT_JSON|STAT_F_JSON_SCHM)) {
|
||||
if (!htx_add_header(htx, ist("Content-Type"), ist("application/json")))
|
||||
goto full;
|
||||
}
|
||||
@ -1512,13 +1512,13 @@ static int stats_send_http_headers(struct stconn *sc, struct htx *htx)
|
||||
goto full;
|
||||
}
|
||||
|
||||
if (uri->refresh > 0 && !(ctx->flags & STAT_NO_REFRESH)) {
|
||||
if (uri->refresh > 0 && !(ctx->flags & STAT_F_NO_REFRESH)) {
|
||||
const char *refresh = U2A(uri->refresh);
|
||||
if (!htx_add_header(htx, ist("Refresh"), ist(refresh)))
|
||||
goto full;
|
||||
}
|
||||
|
||||
if (ctx->flags & STAT_CHUNKED) {
|
||||
if (ctx->flags & STAT_F_CHUNKED) {
|
||||
if (!htx_add_header(htx, ist("Transfer-Encoding"), ist("chunked")))
|
||||
goto full;
|
||||
}
|
||||
@ -1567,8 +1567,8 @@ static int stats_send_http_redirect(struct stconn *sc, struct htx *htx)
|
||||
stat_status_codes[ctx->st_code]) ?
|
||||
stat_status_codes[ctx->st_code] :
|
||||
stat_status_codes[STAT_STATUS_UNKN],
|
||||
(ctx->flags & STAT_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_NO_REFRESH) ? ";norefresh" : "",
|
||||
(ctx->flags & STAT_F_HIDE_DOWN) ? ";up" : "",
|
||||
(ctx->flags & STAT_F_NO_REFRESH) ? ";norefresh" : "",
|
||||
scope_txt);
|
||||
|
||||
flags = (HTX_SL_F_IS_RESP|HTX_SL_F_VER_11|HTX_SL_F_XFER_LEN|HTX_SL_F_CLEN|HTX_SL_F_CHNK);
|
||||
|
@ -170,7 +170,7 @@ int stats_dump_fields_json(struct buffer *out,
|
||||
int started = (ctx->field) ? 1 : 0;
|
||||
int ready_data = 0;
|
||||
|
||||
if (!started && (flags & STAT_STARTED) && !chunk_strcat(out, ","))
|
||||
if (!started && (flags & STAT_F_STARTED) && !chunk_strcat(out, ","))
|
||||
return 0;
|
||||
if (!started && !chunk_strcat(out, "["))
|
||||
return 0;
|
||||
@ -225,7 +225,7 @@ err:
|
||||
if (!ready_data) {
|
||||
/* not enough buffer space for a single entry.. */
|
||||
chunk_reset(out);
|
||||
if (ctx->flags & STAT_STARTED)
|
||||
if (ctx->flags & STAT_F_STARTED)
|
||||
chunk_strcat(out, ",");
|
||||
chunk_appendf(out, "{\"errorStr\":\"output buffer too short\"}");
|
||||
return 0; /* hard error */
|
||||
|
124
src/stats.c
124
src/stats.c
@ -81,7 +81,7 @@ const char *stat_status_codes[STAT_STATUS_SIZE] = {
|
||||
[STAT_STATUS_IVAL] = "IVAL",
|
||||
};
|
||||
|
||||
/* These are the names for each ST_I_INF_* field position. Please pay attention
|
||||
/* These are the metric names for each ST_I_INF_* field position. Please pay attention
|
||||
* to always use the exact same name except that the strings for new names must
|
||||
* be lower case or CamelCase while the enum entries must be upper case.
|
||||
*/
|
||||
@ -571,7 +571,7 @@ static int stats_dump_fields_typed(struct buffer *out,
|
||||
if (!stats_emit_typed_data_field(out, &line[i]))
|
||||
return 0;
|
||||
|
||||
if (flags & STAT_SHOW_FDESC &&
|
||||
if (flags & STAT_F_SHOW_FDESC &&
|
||||
!chunk_appendf(out, ":\"%s\"", metrics[domain][i].desc)) {
|
||||
return 0;
|
||||
}
|
||||
@ -590,11 +590,11 @@ int stats_dump_one_line(const struct field *line, size_t stats_count,
|
||||
struct buffer *chk = &ctx->chunk;
|
||||
int ret;
|
||||
|
||||
if (ctx->flags & STAT_FMT_HTML)
|
||||
if (ctx->flags & STAT_F_FMT_HTML)
|
||||
ret = stats_dump_fields_html(chk, line, ctx);
|
||||
else if (ctx->flags & STAT_FMT_TYPED)
|
||||
else if (ctx->flags & STAT_F_FMT_TYPED)
|
||||
ret = stats_dump_fields_typed(chk, line, stats_count, ctx);
|
||||
else if (ctx->flags & STAT_FMT_JSON)
|
||||
else if (ctx->flags & STAT_F_FMT_JSON)
|
||||
ret = stats_dump_fields_json(chk, line, stats_count, ctx);
|
||||
else
|
||||
ret = stats_dump_fields_csv(chk, line, stats_count, ctx);
|
||||
@ -841,7 +841,7 @@ static int stats_dump_fe_line(struct stconn *sc, struct proxy *px)
|
||||
if (!(px->cap & PR_CAP_FE))
|
||||
return 0;
|
||||
|
||||
if ((ctx->flags & STAT_BOUND) && !(ctx->type & (1 << STATS_TYPE_FE)))
|
||||
if ((ctx->flags & STAT_F_BOUND) && !(ctx->type & (1 << STATS_TYPE_FE)))
|
||||
return 0;
|
||||
|
||||
memset(line, 0, sizeof(struct field) * metrics_len[STATS_DOMAIN_PROXY]);
|
||||
@ -870,7 +870,7 @@ static int stats_dump_fe_line(struct stconn *sc, struct proxy *px)
|
||||
* length <len>. The length of the array must be at least ST_I_PX_MAX. If
|
||||
* this length is less then this value, the function returns 0, otherwise, it
|
||||
* returns 1. If selected_field is != NULL, only fill this one. <flags> can
|
||||
* take the value STAT_SHLGNDS.
|
||||
* take the value STAT_F_SHLGNDS.
|
||||
*/
|
||||
int stats_fill_li_line(struct proxy *px, struct listener *l, int flags,
|
||||
struct field *line, int len, enum stat_idx_px *selected_field)
|
||||
@ -957,7 +957,7 @@ int stats_fill_li_line(struct proxy *px, struct listener *l, int flags,
|
||||
field = mkf_u64(FN_COUNTER, l->counters->internal_errors);
|
||||
break;
|
||||
case ST_I_PX_ADDR:
|
||||
if (flags & STAT_SHLGNDS) {
|
||||
if (flags & STAT_F_SHLGNDS) {
|
||||
char str[INET6_ADDRSTRLEN];
|
||||
int port;
|
||||
|
||||
@ -1119,7 +1119,7 @@ static void stats_fill_sv_computestate(struct server *sv, struct server *ref,
|
||||
* of the array must be at least ST_I_PX_MAX. If this length is less than
|
||||
* this value, or if the selected field is not implemented for servers, the
|
||||
* function returns 0, otherwise, it returns 1. <flags> can take the value
|
||||
* STAT_SHLGNDS.
|
||||
* STAT_F_SHLGNDS.
|
||||
*/
|
||||
int stats_fill_sv_line(struct proxy *px, struct server *sv, int flags,
|
||||
struct field *line, int len,
|
||||
@ -1476,7 +1476,7 @@ int stats_fill_sv_line(struct proxy *px, struct server *sv, int flags,
|
||||
field = mkf_u32(FN_MAX, sv->counters.ttime_max);
|
||||
break;
|
||||
case ST_I_PX_ADDR:
|
||||
if (flags & STAT_SHLGNDS) {
|
||||
if (flags & STAT_F_SHLGNDS) {
|
||||
switch (addr_to_str(&sv->addr, str, sizeof(str))) {
|
||||
case AF_INET:
|
||||
field = mkf_str(FO_CONFIG|FS_SERVICE, chunk_newstr(out));
|
||||
@ -1499,7 +1499,7 @@ int stats_fill_sv_line(struct proxy *px, struct server *sv, int flags,
|
||||
}
|
||||
break;
|
||||
case ST_I_PX_COOKIE:
|
||||
if (flags & STAT_SHLGNDS && sv->cookie)
|
||||
if (flags & STAT_F_SHLGNDS && sv->cookie)
|
||||
field = mkf_str(FO_CONFIG|FN_NAME|FS_SERVICE, sv->cookie);
|
||||
break;
|
||||
default:
|
||||
@ -1590,7 +1590,7 @@ static void stats_fill_be_computesrv(struct proxy *px, int *nbup, int *nbsrv, in
|
||||
* of the array must be at least ST_I_PX_MAX. If this length is less than
|
||||
* this value, or if the selected field is not implemented for backends, the
|
||||
* function returns 0, otherwise, it returns 1. <flags> can take the value
|
||||
* STAT_SHLGNDS.
|
||||
* STAT_F_SHLGNDS.
|
||||
*/
|
||||
int stats_fill_be_line(struct proxy *px, int flags, struct field *line, int len,
|
||||
enum stat_idx_px *index)
|
||||
@ -1691,7 +1691,7 @@ int stats_fill_be_line(struct proxy *px, int flags, struct field *line, int len,
|
||||
case ST_I_PX_STATUS:
|
||||
fld = chunk_newstr(out);
|
||||
chunk_appendf(out, "%s", (px->lbprm.tot_weight > 0 || !px->srv) ? "UP" : "DOWN");
|
||||
if (flags & (STAT_HIDE_MAINT|STAT_HIDE_DOWN))
|
||||
if (flags & (STAT_F_HIDE_MAINT|STAT_F_HIDE_DOWN))
|
||||
chunk_appendf(out, " (%d/%d)", nbup, nbsrv);
|
||||
field = mkf_str(FO_STATUS, fld);
|
||||
break;
|
||||
@ -1746,11 +1746,11 @@ int stats_fill_be_line(struct proxy *px, int flags, struct field *line, int len,
|
||||
field = mkf_u32(0, px->be_counters.sps_max);
|
||||
break;
|
||||
case ST_I_PX_COOKIE:
|
||||
if (flags & STAT_SHLGNDS && px->cookie_name)
|
||||
if (flags & STAT_F_SHLGNDS && px->cookie_name)
|
||||
field = mkf_str(FO_CONFIG|FN_NAME|FS_SERVICE, px->cookie_name);
|
||||
break;
|
||||
case ST_I_PX_ALGO:
|
||||
if (flags & STAT_SHLGNDS)
|
||||
if (flags & STAT_F_SHLGNDS)
|
||||
field = mkf_str(FO_CONFIG|FS_SERVICE, backend_lb_algo_str(px->lbprm.algo & BE_LB_ALGO));
|
||||
break;
|
||||
case ST_I_PX_REQ_TOT:
|
||||
@ -1864,7 +1864,7 @@ static int stats_dump_be_line(struct stconn *sc, struct proxy *px)
|
||||
if (!(px->cap & PR_CAP_BE))
|
||||
return 0;
|
||||
|
||||
if ((ctx->flags & STAT_BOUND) && !(ctx->type & (1 << STATS_TYPE_BE)))
|
||||
if ((ctx->flags & STAT_F_BOUND) && !(ctx->type & (1 << STATS_TYPE_BE)))
|
||||
return 0;
|
||||
|
||||
memset(line, 0, sizeof(struct field) * metrics_len[STATS_DOMAIN_PROXY]);
|
||||
@ -1954,7 +1954,7 @@ more:
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((ctx->flags & STAT_BOUND) &&
|
||||
if ((ctx->flags & STAT_F_BOUND) &&
|
||||
(ctx->iid != -1) &&
|
||||
(px->uuid != ctx->iid))
|
||||
return 1;
|
||||
@ -1963,7 +1963,7 @@ more:
|
||||
__fallthrough;
|
||||
|
||||
case STAT_PX_ST_TH:
|
||||
if (ctx->flags & STAT_FMT_HTML) {
|
||||
if (ctx->flags & STAT_F_FMT_HTML) {
|
||||
stats_dump_html_px_hdr(sc, px);
|
||||
if (!stats_putchk(appctx, buf, htx))
|
||||
goto full;
|
||||
@ -1977,7 +1977,7 @@ more:
|
||||
if (stats_dump_fe_line(sc, px)) {
|
||||
if (!stats_putchk(appctx, buf, htx))
|
||||
goto full;
|
||||
ctx->flags |= STAT_STARTED;
|
||||
ctx->flags |= STAT_F_STARTED;
|
||||
if (ctx->field)
|
||||
goto more;
|
||||
}
|
||||
@ -1997,7 +1997,7 @@ more:
|
||||
if (!l->counters)
|
||||
continue;
|
||||
|
||||
if (ctx->flags & STAT_BOUND) {
|
||||
if (ctx->flags & STAT_F_BOUND) {
|
||||
if (!(ctx->type & (1 << STATS_TYPE_SO)))
|
||||
break;
|
||||
|
||||
@ -2009,7 +2009,7 @@ more:
|
||||
if (stats_dump_li_line(sc, px, l)) {
|
||||
if (!stats_putchk(appctx, buf, htx))
|
||||
goto full;
|
||||
ctx->flags |= STAT_STARTED;
|
||||
ctx->flags |= STAT_F_STARTED;
|
||||
if (ctx->field)
|
||||
goto more;
|
||||
}
|
||||
@ -2053,7 +2053,7 @@ more:
|
||||
if (stats_is_full(appctx, buf, htx))
|
||||
goto full;
|
||||
|
||||
if (ctx->flags & STAT_BOUND) {
|
||||
if (ctx->flags & STAT_F_BOUND) {
|
||||
if (!(ctx->type & (1 << STATS_TYPE_SV))) {
|
||||
srv_drop(sv);
|
||||
break;
|
||||
@ -2064,7 +2064,7 @@ more:
|
||||
}
|
||||
|
||||
/* do not report disabled servers */
|
||||
if (ctx->flags & STAT_HIDE_MAINT &&
|
||||
if (ctx->flags & STAT_F_HIDE_MAINT &&
|
||||
sv->cur_admin & SRV_ADMF_MAINT) {
|
||||
continue;
|
||||
}
|
||||
@ -2074,7 +2074,7 @@ more:
|
||||
svs = svs->track;
|
||||
|
||||
/* do not report servers which are DOWN and not changing state */
|
||||
if ((ctx->flags & STAT_HIDE_DOWN) &&
|
||||
if ((ctx->flags & STAT_F_HIDE_DOWN) &&
|
||||
((sv->cur_admin & SRV_ADMF_MAINT) || /* server is in maintenance */
|
||||
(sv->cur_state == SRV_ST_STOPPED && /* server is down */
|
||||
(!((svs->agent.state | svs->check.state) & CHK_ST_ENABLED) ||
|
||||
@ -2086,7 +2086,7 @@ more:
|
||||
if (stats_dump_sv_line(sc, px, sv)) {
|
||||
if (!stats_putchk(appctx, buf, htx))
|
||||
goto full;
|
||||
ctx->flags |= STAT_STARTED;
|
||||
ctx->flags |= STAT_F_STARTED;
|
||||
if (ctx->field)
|
||||
goto more;
|
||||
}
|
||||
@ -2101,7 +2101,7 @@ more:
|
||||
if (stats_dump_be_line(sc, px)) {
|
||||
if (!stats_putchk(appctx, buf, htx))
|
||||
goto full;
|
||||
ctx->flags |= STAT_STARTED;
|
||||
ctx->flags |= STAT_F_STARTED;
|
||||
if (ctx->field)
|
||||
goto more;
|
||||
}
|
||||
@ -2111,7 +2111,7 @@ more:
|
||||
__fallthrough;
|
||||
|
||||
case STAT_PX_ST_END:
|
||||
if (ctx->flags & STAT_FMT_HTML) {
|
||||
if (ctx->flags & STAT_F_FMT_HTML) {
|
||||
stats_dump_html_px_end(sc, px);
|
||||
if (!stats_putchk(appctx, buf, htx))
|
||||
goto full;
|
||||
@ -2192,19 +2192,19 @@ int stats_dump_stat_to_buffer(struct stconn *sc, struct buffer *buf, struct htx
|
||||
__fallthrough;
|
||||
|
||||
case STAT_STATE_HEAD:
|
||||
if (ctx->flags & STAT_FMT_HTML)
|
||||
if (ctx->flags & STAT_F_FMT_HTML)
|
||||
stats_dump_html_head(appctx);
|
||||
else if (ctx->flags & STAT_JSON_SCHM)
|
||||
else if (ctx->flags & STAT_F_JSON_SCHM)
|
||||
stats_dump_json_schema(chk);
|
||||
else if (ctx->flags & STAT_FMT_JSON)
|
||||
else if (ctx->flags & STAT_F_FMT_JSON)
|
||||
stats_dump_json_header(chk);
|
||||
else if (!(ctx->flags & STAT_FMT_TYPED))
|
||||
else if (!(ctx->flags & STAT_F_FMT_TYPED))
|
||||
stats_dump_csv_header(ctx->domain, chk);
|
||||
|
||||
if (!stats_putchk(appctx, buf, htx))
|
||||
goto full;
|
||||
|
||||
if (ctx->flags & STAT_JSON_SCHM) {
|
||||
if (ctx->flags & STAT_F_JSON_SCHM) {
|
||||
ctx->state = STAT_STATE_FIN;
|
||||
return 1;
|
||||
}
|
||||
@ -2212,7 +2212,7 @@ int stats_dump_stat_to_buffer(struct stconn *sc, struct buffer *buf, struct htx
|
||||
__fallthrough;
|
||||
|
||||
case STAT_STATE_INFO:
|
||||
if (ctx->flags & STAT_FMT_HTML) {
|
||||
if (ctx->flags & STAT_F_FMT_HTML) {
|
||||
stats_dump_html_info(sc);
|
||||
if (!stats_putchk(appctx, buf, htx))
|
||||
goto full;
|
||||
@ -2248,8 +2248,8 @@ int stats_dump_stat_to_buffer(struct stconn *sc, struct buffer *buf, struct htx
|
||||
__fallthrough;
|
||||
|
||||
case STAT_STATE_END:
|
||||
if (ctx->flags & (STAT_FMT_HTML|STAT_FMT_JSON)) {
|
||||
if (ctx->flags & STAT_FMT_HTML)
|
||||
if (ctx->flags & (STAT_F_FMT_HTML|STAT_F_FMT_JSON)) {
|
||||
if (ctx->flags & STAT_F_FMT_HTML)
|
||||
stats_dump_html_end(chk);
|
||||
else
|
||||
stats_dump_json_end(chk);
|
||||
@ -2290,7 +2290,7 @@ static int stats_dump_info_fields(struct buffer *out,
|
||||
return 0;
|
||||
if (!stats_emit_raw_data_field(out, &line[i]))
|
||||
return 0;
|
||||
if ((flags & STAT_SHOW_FDESC) && !chunk_appendf(out, ":\"%s\"", metrics_info[i].desc))
|
||||
if ((flags & STAT_F_SHOW_FDESC) && !chunk_appendf(out, ":\"%s\"", metrics_info[i].desc))
|
||||
return 0;
|
||||
if (!chunk_strcat(out, "\n"))
|
||||
return 0;
|
||||
@ -2318,7 +2318,7 @@ static int stats_dump_typed_info_fields(struct buffer *out,
|
||||
return 0;
|
||||
if (!stats_emit_typed_data_field(out, &line[i]))
|
||||
return 0;
|
||||
if ((flags & STAT_SHOW_FDESC) && !chunk_appendf(out, ":\"%s\"", metrics_info[i].desc))
|
||||
if ((flags & STAT_F_SHOW_FDESC) && !chunk_appendf(out, ":\"%s\"", metrics_info[i].desc))
|
||||
return 0;
|
||||
if (!chunk_strcat(out, "\n"))
|
||||
return 0;
|
||||
@ -2329,7 +2329,7 @@ static int stats_dump_typed_info_fields(struct buffer *out,
|
||||
/* Fill <info> with HAProxy global info. <info> is preallocated array of length
|
||||
* <len>. The length of the array must be ST_I_INF_MAX. If this length is
|
||||
* less then this value, the function returns 0, otherwise, it returns 1. Some
|
||||
* fields' presence or precision may depend on some of the STAT_* flags present
|
||||
* fields' presence or precision may depend on some of the STAT_F_* flags present
|
||||
* in <flags>.
|
||||
*/
|
||||
int stats_fill_info(struct field *line, int len, uint flags)
|
||||
@ -2384,8 +2384,8 @@ int stats_fill_info(struct field *line, int len, uint flags)
|
||||
line[ST_I_INF_UPTIME] = mkf_str(FN_DURATION, chunk_newstr(out));
|
||||
chunk_appendf(out, "%ud %uh%02um%02us", up_sec / 86400, (up_sec % 86400) / 3600, (up_sec % 3600) / 60, (up_sec % 60));
|
||||
|
||||
line[ST_I_INF_UPTIME_SEC] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_DURATION, up_sec + up_usec / 1000000.0) : mkf_u32(FN_DURATION, up_sec);
|
||||
line[ST_I_INF_START_TIME_SEC] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_DURATION, start_date.tv_sec + start_date.tv_usec / 1000000.0) : mkf_u32(FN_DURATION, start_date.tv_sec);
|
||||
line[ST_I_INF_UPTIME_SEC] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_DURATION, up_sec + up_usec / 1000000.0) : mkf_u32(FN_DURATION, up_sec);
|
||||
line[ST_I_INF_START_TIME_SEC] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_DURATION, start_date.tv_sec + start_date.tv_usec / 1000000.0) : mkf_u32(FN_DURATION, start_date.tv_sec);
|
||||
line[ST_I_INF_MEMMAX_MB] = mkf_u32(FO_CONFIG|FN_LIMIT, global.rlimit_memmax);
|
||||
line[ST_I_INF_MEMMAX_BYTES] = mkf_u32(FO_CONFIG|FN_LIMIT, global.rlimit_memmax * 1048576L);
|
||||
line[ST_I_INF_POOL_ALLOC_MB] = mkf_u32(0, (unsigned)(pool_total_allocated() / 1048576L));
|
||||
@ -2408,27 +2408,27 @@ int stats_fill_info(struct field *line, int len, uint flags)
|
||||
line[ST_I_INF_MAXPIPES] = mkf_u32(FO_CONFIG|FN_LIMIT, global.maxpipes);
|
||||
line[ST_I_INF_PIPES_USED] = mkf_u32(0, pipes_used);
|
||||
line[ST_I_INF_PIPES_FREE] = mkf_u32(0, pipes_free);
|
||||
line[ST_I_INF_CONN_RATE] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.conn_per_sec)) : mkf_u32(FN_RATE, read_freq_ctr(&global.conn_per_sec));
|
||||
line[ST_I_INF_CONN_RATE] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.conn_per_sec)) : mkf_u32(FN_RATE, read_freq_ctr(&global.conn_per_sec));
|
||||
line[ST_I_INF_CONN_RATE_LIMIT] = mkf_u32(FO_CONFIG|FN_LIMIT, global.cps_lim);
|
||||
line[ST_I_INF_MAX_CONN_RATE] = mkf_u32(FN_MAX, global.cps_max);
|
||||
line[ST_I_INF_SESS_RATE] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.sess_per_sec)) : mkf_u32(FN_RATE, read_freq_ctr(&global.sess_per_sec));
|
||||
line[ST_I_INF_SESS_RATE] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.sess_per_sec)) : mkf_u32(FN_RATE, read_freq_ctr(&global.sess_per_sec));
|
||||
line[ST_I_INF_SESS_RATE_LIMIT] = mkf_u32(FO_CONFIG|FN_LIMIT, global.sps_lim);
|
||||
line[ST_I_INF_MAX_SESS_RATE] = mkf_u32(FN_RATE, global.sps_max);
|
||||
|
||||
#ifdef USE_OPENSSL
|
||||
line[ST_I_INF_SSL_RATE] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_RATE, ssl_sess_rate) : mkf_u32(FN_RATE, ssl_sess_rate);
|
||||
line[ST_I_INF_SSL_RATE] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_RATE, ssl_sess_rate) : mkf_u32(FN_RATE, ssl_sess_rate);
|
||||
line[ST_I_INF_SSL_RATE_LIMIT] = mkf_u32(FO_CONFIG|FN_LIMIT, global.ssl_lim);
|
||||
line[ST_I_INF_MAX_SSL_RATE] = mkf_u32(FN_MAX, global.ssl_max);
|
||||
line[ST_I_INF_SSL_FRONTEND_KEY_RATE] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_RATE, ssl_key_rate) : mkf_u32(0, ssl_key_rate);
|
||||
line[ST_I_INF_SSL_FRONTEND_KEY_RATE] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_RATE, ssl_key_rate) : mkf_u32(0, ssl_key_rate);
|
||||
line[ST_I_INF_SSL_FRONTEND_MAX_KEY_RATE] = mkf_u32(FN_MAX, global.ssl_fe_keys_max);
|
||||
line[ST_I_INF_SSL_FRONTEND_SESSION_REUSE_PCT] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_RATE, ssl_reuse) : mkf_u32(0, ssl_reuse);
|
||||
line[ST_I_INF_SSL_BACKEND_KEY_RATE] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.ssl_be_keys_per_sec)) : mkf_u32(FN_RATE, read_freq_ctr(&global.ssl_be_keys_per_sec));
|
||||
line[ST_I_INF_SSL_FRONTEND_SESSION_REUSE_PCT] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_RATE, ssl_reuse) : mkf_u32(0, ssl_reuse);
|
||||
line[ST_I_INF_SSL_BACKEND_KEY_RATE] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.ssl_be_keys_per_sec)) : mkf_u32(FN_RATE, read_freq_ctr(&global.ssl_be_keys_per_sec));
|
||||
line[ST_I_INF_SSL_BACKEND_MAX_KEY_RATE] = mkf_u32(FN_MAX, global.ssl_be_keys_max);
|
||||
line[ST_I_INF_SSL_CACHE_LOOKUPS] = mkf_u32(FN_COUNTER, global.shctx_lookups);
|
||||
line[ST_I_INF_SSL_CACHE_MISSES] = mkf_u32(FN_COUNTER, global.shctx_misses);
|
||||
#endif
|
||||
line[ST_I_INF_COMPRESS_BPS_IN] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.comp_bps_in)) : mkf_u32(FN_RATE, read_freq_ctr(&global.comp_bps_in));
|
||||
line[ST_I_INF_COMPRESS_BPS_OUT] = (flags & STAT_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.comp_bps_out)) : mkf_u32(FN_RATE, read_freq_ctr(&global.comp_bps_out));
|
||||
line[ST_I_INF_COMPRESS_BPS_IN] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.comp_bps_in)) : mkf_u32(FN_RATE, read_freq_ctr(&global.comp_bps_in));
|
||||
line[ST_I_INF_COMPRESS_BPS_OUT] = (flags & STAT_F_USE_FLOAT) ? mkf_flt(FN_RATE, read_freq_ctr_flt(&global.comp_bps_out)) : mkf_u32(FN_RATE, read_freq_ctr(&global.comp_bps_out));
|
||||
line[ST_I_INF_COMPRESS_BPS_RATE_LIM] = mkf_u32(FO_CONFIG|FN_LIMIT, global.comp_rate_lim);
|
||||
#ifdef USE_ZLIB
|
||||
line[ST_I_INF_ZLIB_MEM_USAGE] = mkf_u32(0, zlib_used_memory);
|
||||
@ -2484,9 +2484,9 @@ static int stats_dump_info_to_buffer(struct stconn *sc)
|
||||
more:
|
||||
current_field = ctx->field;
|
||||
|
||||
if (ctx->flags & STAT_FMT_TYPED)
|
||||
if (ctx->flags & STAT_F_FMT_TYPED)
|
||||
ret = stats_dump_typed_info_fields(chk, stat_line_info, ctx);
|
||||
else if (ctx->flags & STAT_FMT_JSON)
|
||||
else if (ctx->flags & STAT_F_FMT_JSON)
|
||||
ret = stats_dump_json_info_fields(chk, stat_line_info, ctx);
|
||||
else
|
||||
ret = stats_dump_info_fields(chk, stat_line_info, ctx);
|
||||
@ -2630,13 +2630,13 @@ static int cli_parse_show_info(char **args, char *payload, struct appctx *appctx
|
||||
|
||||
while (*args[arg]) {
|
||||
if (strcmp(args[arg], "typed") == 0)
|
||||
ctx->flags = (ctx->flags & ~STAT_FMT_MASK) | STAT_FMT_TYPED;
|
||||
ctx->flags = (ctx->flags & ~STAT_F_FMT_MASK) | STAT_F_FMT_TYPED;
|
||||
else if (strcmp(args[arg], "json") == 0)
|
||||
ctx->flags = (ctx->flags & ~STAT_FMT_MASK) | STAT_FMT_JSON;
|
||||
ctx->flags = (ctx->flags & ~STAT_F_FMT_MASK) | STAT_F_FMT_JSON;
|
||||
else if (strcmp(args[arg], "desc") == 0)
|
||||
ctx->flags |= STAT_SHOW_FDESC;
|
||||
ctx->flags |= STAT_F_SHOW_FDESC;
|
||||
else if (strcmp(args[arg], "float") == 0)
|
||||
ctx->flags |= STAT_USE_FLOAT;
|
||||
ctx->flags |= STAT_F_USE_FLOAT;
|
||||
arg++;
|
||||
}
|
||||
return 0;
|
||||
@ -2651,10 +2651,10 @@ static int cli_parse_show_stat(char **args, char *payload, struct appctx *appctx
|
||||
ctx->scope_str = 0;
|
||||
ctx->scope_len = 0;
|
||||
ctx->http_px = NULL; // not under http context
|
||||
ctx->flags = STAT_SHNODE | STAT_SHDESC;
|
||||
ctx->flags = STAT_F_SHNODE | STAT_F_SHDESC;
|
||||
|
||||
if ((strm_li(appctx_strm(appctx))->bind_conf->level & ACCESS_LVL_MASK) >= ACCESS_LVL_OPER)
|
||||
ctx->flags |= STAT_SHLGNDS;
|
||||
ctx->flags |= STAT_F_SHLGNDS;
|
||||
|
||||
/* proxy is the default domain */
|
||||
ctx->domain = STATS_DOMAIN_PROXY;
|
||||
@ -2684,7 +2684,7 @@ static int cli_parse_show_stat(char **args, char *payload, struct appctx *appctx
|
||||
if (!ctx->iid)
|
||||
return cli_err(appctx, "No such proxy.\n");
|
||||
|
||||
ctx->flags |= STAT_BOUND;
|
||||
ctx->flags |= STAT_F_BOUND;
|
||||
ctx->type = atoi(args[arg+1]);
|
||||
ctx->sid = atoi(args[arg+2]);
|
||||
arg += 3;
|
||||
@ -2692,15 +2692,15 @@ static int cli_parse_show_stat(char **args, char *payload, struct appctx *appctx
|
||||
|
||||
while (*args[arg]) {
|
||||
if (strcmp(args[arg], "typed") == 0)
|
||||
ctx->flags = (ctx->flags & ~STAT_FMT_MASK) | STAT_FMT_TYPED;
|
||||
ctx->flags = (ctx->flags & ~STAT_F_FMT_MASK) | STAT_F_FMT_TYPED;
|
||||
else if (strcmp(args[arg], "json") == 0)
|
||||
ctx->flags = (ctx->flags & ~STAT_FMT_MASK) | STAT_FMT_JSON;
|
||||
ctx->flags = (ctx->flags & ~STAT_F_FMT_MASK) | STAT_F_FMT_JSON;
|
||||
else if (strcmp(args[arg], "desc") == 0)
|
||||
ctx->flags |= STAT_SHOW_FDESC;
|
||||
ctx->flags |= STAT_F_SHOW_FDESC;
|
||||
else if (strcmp(args[arg], "no-maint") == 0)
|
||||
ctx->flags |= STAT_HIDE_MAINT;
|
||||
ctx->flags |= STAT_F_HIDE_MAINT;
|
||||
else if (strcmp(args[arg], "up") == 0)
|
||||
ctx->flags |= STAT_HIDE_DOWN;
|
||||
ctx->flags |= STAT_F_HIDE_DOWN;
|
||||
arg++;
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ struct uri_auth *stats_set_realm(struct uri_auth **root, char *realm)
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a default uri_auth with STAT_SHNODE flag enabled and
|
||||
* Returns a default uri_auth with STAT_F_SHNODE flag enabled and
|
||||
* <node> set as the name if it is not empty.
|
||||
* Uses the pointer provided if not NULL and not initialized.
|
||||
*/
|
||||
@ -128,7 +128,7 @@ struct uri_auth *stats_set_node(struct uri_auth **root, char *name)
|
||||
if ((u = stats_check_init_uri_auth(root)) == NULL)
|
||||
goto out_u;
|
||||
|
||||
if (!stats_set_flag(root, STAT_SHNODE))
|
||||
if (!stats_set_flag(root, STAT_F_SHNODE))
|
||||
goto out_u;
|
||||
|
||||
if (node_copy) {
|
||||
@ -145,7 +145,7 @@ struct uri_auth *stats_set_node(struct uri_auth **root, char *name)
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a default uri_auth with STAT_SHDESC flag enabled and
|
||||
* Returns a default uri_auth with STAT_F_SHDESC flag enabled and
|
||||
* <description> set as the desc if it is not empty.
|
||||
* Uses the pointer provided if not NULL and not initialized.
|
||||
*/
|
||||
@ -163,7 +163,7 @@ struct uri_auth *stats_set_desc(struct uri_auth **root, char *desc)
|
||||
if ((u = stats_check_init_uri_auth(root)) == NULL)
|
||||
goto out_u;
|
||||
|
||||
if (!stats_set_flag(root, STAT_SHDESC))
|
||||
if (!stats_set_flag(root, STAT_F_SHDESC))
|
||||
goto out_u;
|
||||
|
||||
if (desc_copy) {
|
||||
|
Loading…
Reference in New Issue
Block a user