[MINOR] Add "clear counters" to clear statistics counters
Now, when statistics counters are moved to separate structures, adding "clear counters" is extremely easy. [wt: updated the help message]
This commit is contained in:
parent
052d4fd07d
commit
719e726c97
|
@ -6724,6 +6724,10 @@ show stat [<iid> <type> <sid>]
|
||||||
A similar empty line appears at the end of the second block (stats) so that
|
A similar empty line appears at the end of the second block (stats) so that
|
||||||
the reader knows the output has not been trucated.
|
the reader knows the output has not been trucated.
|
||||||
|
|
||||||
|
clear counters
|
||||||
|
Clear statistics counters in each proxy (frontend & backend) and in each
|
||||||
|
server.
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local variables:
|
* Local variables:
|
||||||
* fill-column: 79
|
* fill-column: 79
|
||||||
|
|
|
@ -53,14 +53,15 @@
|
||||||
#include <proto/task.h>
|
#include <proto/task.h>
|
||||||
|
|
||||||
const char stats_sock_usage_msg[] =
|
const char stats_sock_usage_msg[] =
|
||||||
"Unknown command. Please enter one of the following commands only :\n"
|
"Unknown command. Please enter one of the following commands only :\n"
|
||||||
" help : this message\n"
|
" clear counters : clear statistics counters\n"
|
||||||
" prompt : toggle interactive mode with prompt\n"
|
" help : this message\n"
|
||||||
" quit : disconnect\n"
|
" prompt : toggle interactive mode with prompt\n"
|
||||||
" show info : report information about the running process\n"
|
" quit : disconnect\n"
|
||||||
" show stat : report counters for each proxy and server\n"
|
" show info : report information about the running process\n"
|
||||||
" show errors : report last request and response errors for each proxy\n"
|
" show stat : report counters for each proxy and server\n"
|
||||||
" show sess : report the list of current sessions\n"
|
" show errors : report last request and response errors for each proxy\n"
|
||||||
|
" show sess : report the list of current sessions\n"
|
||||||
"";
|
"";
|
||||||
|
|
||||||
const struct chunk stats_sock_usage = {
|
const struct chunk stats_sock_usage = {
|
||||||
|
@ -299,11 +300,29 @@ int stats_sock_parse_request(struct stream_interface *si, char *line)
|
||||||
s->data_state = DATA_ST_INIT;
|
s->data_state = DATA_ST_INIT;
|
||||||
si->st0 = STAT_CLI_O_ERR; // stats_dump_errors_to_buffer
|
si->st0 = STAT_CLI_O_ERR; // stats_dump_errors_to_buffer
|
||||||
}
|
}
|
||||||
else { /* neither "stat" nor "info" nor "sess" */
|
else { /* neither "stat" nor "info" nor "sess" nor "errors"*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { /* not "show" */
|
else if (strcmp(args[0], "clear") == 0) {
|
||||||
|
if (strcmp(args[1], "counters") == 0) {
|
||||||
|
struct proxy *px;
|
||||||
|
struct server *sv;
|
||||||
|
|
||||||
|
for (px = proxy; px; px = px->next) {
|
||||||
|
memset(&px->counters, 0, sizeof(px->counters));
|
||||||
|
|
||||||
|
for (sv = px->srv; sv; sv = sv->next)
|
||||||
|
memset(&sv->counters, 0, sizeof(sv->counters));
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { /* not "show" nor "clear"*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue