mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
[MINOR] stats: use 'clear counters all' to clear all values
The most common use of "clear counters" should be to only clear max values without affecting cumulated values, for instance, after an incident. So we change "clear counters" to only clear max values, and add "clear counters all" to clear all counters.
This commit is contained in:
parent
1d7a420c84
commit
2f6bf2b82c
@ -6843,8 +6843,14 @@ show stat [<iid> <type> <sid>]
|
|||||||
the reader knows the output has not been trucated.
|
the reader knows the output has not been trucated.
|
||||||
|
|
||||||
clear counters
|
clear counters
|
||||||
Clear statistics counters in each proxy (frontend & backend) and in each
|
Clear the max values of the statistics counters in each proxy (frontend &
|
||||||
server.
|
backend) and in each server. The cumulated counters are not affected. This
|
||||||
|
can be used to get clean counters after an incident, without having to
|
||||||
|
restart nor to clear traffic counters.
|
||||||
|
|
||||||
|
clear counters all
|
||||||
|
Clear all statistics counters in each proxy (frontend & backend) and in each
|
||||||
|
server. This has the same effect as restarting.
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local variables:
|
* Local variables:
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
|
|
||||||
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"
|
||||||
" clear counters : clear statistics counters\n"
|
" clear counters : clear max statistics counters (add 'all' for all counters)\n"
|
||||||
" help : this message\n"
|
" help : this message\n"
|
||||||
" prompt : toggle interactive mode with prompt\n"
|
" prompt : toggle interactive mode with prompt\n"
|
||||||
" quit : disconnect\n"
|
" quit : disconnect\n"
|
||||||
@ -309,16 +309,38 @@ int stats_sock_parse_request(struct stream_interface *si, char *line)
|
|||||||
struct proxy *px;
|
struct proxy *px;
|
||||||
struct server *sv;
|
struct server *sv;
|
||||||
struct listener *li;
|
struct listener *li;
|
||||||
|
int clrall = 0;
|
||||||
|
|
||||||
|
if (strcmp(args[2], "all") == 0)
|
||||||
|
clrall = 1;
|
||||||
|
|
||||||
for (px = proxy; px; px = px->next) {
|
for (px = proxy; px; px = px->next) {
|
||||||
memset(&px->counters, 0, sizeof(px->counters));
|
if (clrall)
|
||||||
|
memset(&px->counters, 0, sizeof(px->counters));
|
||||||
|
else {
|
||||||
|
px->counters.feconn_max = 0;
|
||||||
|
px->counters.beconn_max = 0;
|
||||||
|
px->counters.fe_sps_max = 0;
|
||||||
|
px->counters.be_sps_max = 0;
|
||||||
|
px->counters.nbpend_max = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (sv = px->srv; sv; sv = sv->next)
|
for (sv = px->srv; sv; sv = sv->next)
|
||||||
memset(&sv->counters, 0, sizeof(sv->counters));
|
if (clrall)
|
||||||
|
memset(&sv->counters, 0, sizeof(sv->counters));
|
||||||
|
else {
|
||||||
|
sv->counters.cur_sess_max = 0;
|
||||||
|
sv->counters.nbpend_max = 0;
|
||||||
|
sv->counters.sps_max = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (li = px->listen; li; li = li->next)
|
for (li = px->listen; li; li = li->next)
|
||||||
if (li->counters)
|
if (li->counters) {
|
||||||
memset(li->counters, 0, sizeof(*li->counters));
|
if (clrall)
|
||||||
|
memset(li->counters, 0, sizeof(*li->counters));
|
||||||
|
else
|
||||||
|
li->counters->conn_max = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user