[MINOR] checks: add the server's status in the checks
Now a server can check the contents of the header X-Haproxy-Server-State
to know how haproxy sees it. The same values as those reported in the stats
are provided :
- up/down status + check counts
- throttle
- weight vs backend weight
- active sessions vs backend sessions
- queue length
- haproxy node name
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 587a020..ef77254 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -2757,6 +2757,10 @@
/* enable a graceful server shutdown on an HTTP 404 response */
curproxy->options |= PR_O_DISABLE404;
}
+ else if (strcmp(args[1], "send-state") == 0) {
+ /* enable emission of the apparent state of a server in HTTP checks */
+ curproxy->options2 |= PR_O2_CHK_SNDST;
+ }
else {
Alert("parsing [%s:%d] : '%s' only supports 'disable-on-404'.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
@@ -4676,6 +4680,13 @@
err_code |= ERR_WARN;
}
+ if ((curproxy->options2 & PR_O2_CHK_SNDST) && !(curproxy->options & PR_O_HTTP_CHK)) {
+ curproxy->options &= ~PR_O2_CHK_SNDST;
+ Warning("config : '%s' will be ignored for %s '%s' (requires 'option httpchk').\n",
+ "send-state", proxy_type_str(curproxy), curproxy->id);
+ err_code |= ERR_WARN;
+ }
+
/* if a default backend was specified, let's find it */
if (curproxy->defbe.name) {
struct proxy *target;
@@ -5045,7 +5056,7 @@
if (curproxy != px &&
(curproxy->options & PR_O_DISABLE404) != (px->options & PR_O_DISABLE404)) {
Alert("config : %s '%s', server '%s': unable to use %s/%s for"
- "tracing: disable-on-404 option inconsistency.\n",
+ "tracking: disable-on-404 option inconsistency.\n",
proxy_type_str(curproxy), curproxy->id,
newsrv->id, px->id, srv->id);
cfgerr++;