Le Lundi 1 Février 2010 23:43:26, Holger Just a écrit :
> Hi
> 
> On 2010-02-01 23:32, Cyril Bonté wrote:
> > This would give something like :
> > - UP : the server is UP because the tracked server is UP
> > - DOWN/DOWN : the server is DOWN because the tracked server is DOWN => the 
> > line is in red
> > - DOWN/MAINT : the server is DOWN because the tracked server is in 
> > maintenance => the line is in brown
> > - MAINT : the server is in maintenance (no need to know the tracked server 
> > state) => the line is also in brown
> 
> In my world, a unconditional down of any server is considered a major
> problem. Your proposal fits right into that view. So a DOWN is still a
> failure of some sort while DOWN and DOWN/MAINT show the servers state
> cleanly. The DOWN/MAINT is actually way better that MAINT alone as it
> states the cause of the MAINT mode more boldly.
> 
> > Maybe the DOWN/DOWN can be optional to not break current monitoring scripts 
> > implementations (only DOWN will be displayed).
> 
> I think, this should be just plain DOWN to keep current behaviour and
> boldly state the error condition.

OK, you'll find a small update (smaller than I firstly thought) in attachment.

-- 
Cyril Bonté
diff -Naur haproxy-ss-20100201/src/dumpstats.c haproxy-ss-20100201-maintain/src/dumpstats.c
--- haproxy-ss-20100201/src/dumpstats.c	2010-01-31 23:33:18.000000000 +0100
+++ ../haproxy-ss-20100201/src/dumpstats.c	2010-02-02 00:00:27.000000000 +0100
@@ -1708,7 +1708,7 @@
 							       "UP %d/%d ↓", "UP",
 							       "NOLB %d/%d ↓", "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"
@@ -1808,12 +1808,15 @@
 				}
 				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],
 					     (svs->state & SRV_RUNNING) ? (svs->health - svs->rise + 1) : (svs->health),
 					     (svs->state & SRV_RUNNING) ? (svs->fall) : (svs->rise));
+					if (svs != sv && svs->state & SRV_MAINTAIN) {
+						chunk_printf(&msg, "/MAINT");
+					}
 				}
 
 				if (sv->state & SRV_CHECKED) {
@@ -1885,10 +1888,10 @@
 						     "<td class=ac>-</td></tr>\n");
 				}
 			} else {
-				static char *srv_hlt_st[7] = { "DOWN,", "DOWN %d/%d,",
-							       "UP %d/%d,", "UP,",
-							       "NOLB %d/%d,", "NOLB,",
-							       "no check," };
+				static char *srv_hlt_st[7] = { "DOWN", "DOWN %d/%d",
+							       "UP %d/%d", "UP",
+							       "NOLB %d/%d", "NOLB",
+							       "no check" };
 				chunk_printf(&msg,
 				     /* pxid, name */
 				     "%s,%s,"
@@ -1915,17 +1918,20 @@
 
 				/* status */
 				if (sv->state & SRV_MAINTAIN) {
-					chunk_printf(&msg, "MAINT,");
+					chunk_printf(&msg, "MAINT");
 				} else {
 					chunk_printf(&msg,
 					    srv_hlt_st[sv_state],
 					    (svs->state & SRV_RUNNING) ? (svs->health - svs->rise + 1) : (svs->health),
 					    (svs->state & SRV_RUNNING) ? (svs->fall) : (svs->rise));
+					if (svs != sv && svs->state & SRV_MAINTAIN) {
+						chunk_printf(&msg, "/MAINT");
+					}
 				}
 
 				chunk_printf(&msg,
 				     /* weight, active, backup */
-				     "%d,%d,%d,"
+				     ",%d,%d,%d,"
 				     "",
 				     (sv->eweight * px->lbprm.wmult + px->lbprm.wdiv - 1) / px->lbprm.wdiv,
 				     (sv->state & SRV_BACKUP) ? 0 : 1,

Reply via email to