]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] stats: report maint state for tracking servers too
authorCyril Bonté <cyril.bonte@free.fr>
Tue, 2 Feb 2010 23:26:28 +0000 (00:26 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 6 Feb 2010 08:36:14 +0000 (09:36 +0100)
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
src/dumpstats.c

index c5dd0b3a80de5dcd83f01ba580a14ac7b6b95cac..509c281f9d3616592a1515b0b39294f98a8610ab 100644 (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 ('#').
 
index 89006361bac013dc03a3b0f24639c4531fb7c4ed..35af8c12d04439393184416b781353812150d1a5 100644 (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),