diff --git a/doc/management.txt b/doc/management.txt index f42c07120..04b0d40f5 100644 --- a/doc/management.txt +++ b/doc/management.txt @@ -1957,12 +1957,14 @@ show sess The special id "all" dumps the states of all sessions, which must be avoided as much as possible as it is highly CPU intensive and can take a lot of time. -show stat [ ] [typed] +show stat [{|} ] [typed] Dump statistics using the CSV format, or using the extended typed output format described in the section above if "typed" is passed after the other arguments. By passing , and , it is possible to dump only selected items : - - is a proxy ID, -1 to dump everything + - is a proxy ID, -1 to dump everything. Alternatively, a proxy name + may be specified. In this case, this proxy's ID will be used as + the ID selector. - selects the type of dumpable objects : 1 for frontends, 2 for backends, 4 for servers, -1 for everything. These values can be ORed, for example: diff --git a/src/stats.c b/src/stats.c index 1d5b39c27..bfd16994d 100644 --- a/src/stats.c +++ b/src/stats.c @@ -3103,8 +3103,21 @@ static int cli_parse_show_info(char **args, struct appctx *appctx, void *private static int cli_parse_show_stat(char **args, struct appctx *appctx, void *private) { if (*args[2] && *args[3] && *args[4]) { + struct proxy *px; + + px = proxy_find_by_name(args[2], 0, 0); + if (px) + appctx->ctx.stats.iid = px->uuid; + else + appctx->ctx.stats.iid = atoi(args[2]); + + if (!appctx->ctx.stats.iid) { + appctx->ctx.cli.msg = "No such proxy.\n"; + appctx->st0 = CLI_ST_PRINT; + return 1; + } + appctx->ctx.stats.flags |= STAT_BOUND; - appctx->ctx.stats.iid = atoi(args[2]); appctx->ctx.stats.type = atoi(args[3]); appctx->ctx.stats.sid = atoi(args[4]); if (strcmp(args[5], "typed") == 0)