From 0dae5850f62dc6dfe63f5b1cc6891f51fb5550de Mon Sep 17 00:00:00 2001 From: =?utf8?q?Cyril=20Bont=C3=A9?= Date: Wed, 3 Feb 2010 00:26:28 +0100 Subject: [PATCH] [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. --- doc/configuration.txt | 5 ++++- src/dumpstats.c | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index c5dd0b3a80..509c281f9d 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -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 / 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 ('#'). diff --git a/src/dumpstats.c b/src/dumpstats.c index 89006361ba..35af8c12d0 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -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 ↓", "UP", "NOLB %d/%d ↓", "NOLB", "no check" }; - if (sv->state & SRV_MAINTAIN) { + if ((sv->state & SRV_MAINTAIN) || (svs->state & SRV_MAINTAIN)) { chunk_printf(&msg, /* name */ "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), -- 2.47.3