[MINOR] stats: report maint state for tracking servers too

This is to avoid confusing a real server failure and a tracking server
which is marked down because the tracked server was switched to MAINT.
This commit is contained in:
Cyril Bont 2010-02-03 00:26:28 +01:00 committed by Willy Tarreau
parent b4c06b7be6
commit 0dae5850f6
2 changed files with 17 additions and 5 deletions

View File

@ -7587,7 +7587,7 @@ page. Both means provide a CSV format whose fields follow.
14. eresp: response errors
15. wretr: retries (warning)
16. wredis: redispatches (warning)
17. status: status (UP/DOWN/...)
17. status: status (UP/DOWN/NOLB/MAINT/MAINT(via)...)
18. weight: server weight (server), total weight (backend)
19. act: server is active (server), number of active servers (backend)
20. bck: server is backup (server), number of backup servers (backend)
@ -7781,6 +7781,9 @@ disable server <backend>/<server>
If the server is tracked by other servers, those servers will be set to DOWN
during the maintenance.
In the statistics page, a server DOWN for maintenance will appear with a
"MAINT" status, its tracking servers with the "MAINT(via)" one.
Both the backend and the server may be specified either by their name or by
their numeric ID, prefixed with a dash ('#').

View File

@ -1697,7 +1697,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
else
sv_state = 0; /* DOWN */
if ((sv_state == 0) && (s->data_ctx.stats.flags & STAT_HIDE_DOWN)) {
if (((sv_state == 0) || (sv->state & SRV_MAINTAIN)) && (s->data_ctx.stats.flags & STAT_HIDE_DOWN)) {
/* do not report servers which are DOWN */
s->data_ctx.stats.sv = sv->next;
continue;
@ -1708,7 +1708,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
"UP %d/%d &darr;", "UP",
"NOLB %d/%d &darr;", "NOLB",
"<i>no check</i>" };
if (sv->state & SRV_MAINTAIN) {
if ((sv->state & SRV_MAINTAIN) || (svs->state & SRV_MAINTAIN)) {
chunk_printf(&msg,
/* name */
"<tr class=\"maintain\"><td class=ac"
@ -1806,9 +1806,14 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
human_time(now.tv_sec - sv->last_change, 1));
chunk_printf(&msg, "MAINT");
}
else if (svs != sv && svs->state & SRV_MAINTAIN) {
chunk_printf(&msg, "%s ",
human_time(now.tv_sec - svs->last_change, 1));
chunk_printf(&msg, "MAINT(via)");
}
else if (svs->state & SRV_CHECKED) {
chunk_printf(&msg, "%s ",
human_time(now.tv_sec - sv->last_change, 1));
human_time(now.tv_sec - svs->last_change, 1));
chunk_printf(&msg,
srv_hlt_st[sv_state],
@ -1916,7 +1921,11 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
/* status */
if (sv->state & SRV_MAINTAIN) {
chunk_printf(&msg, "MAINT,");
} else {
}
else if (svs != sv && svs->state & SRV_MAINTAIN) {
chunk_printf(&msg, "MAINT(via),");
}
else {
chunk_printf(&msg,
srv_hlt_st[sv_state],
(svs->state & SRV_RUNNING) ? (svs->health - svs->rise + 1) : (svs->health),