MEDIUM: Do not mark a server as down if the agent is unavailable

In the case where agent-port is used and the agent
check is a secondary check to not mark a server as down
if the agent becomes unavailable.

In this configuration the agent should only cause a server to be marked
as down if the agent returns "fail", "stopped" or "down".

Signed-off-by: Simon Horman <horms@verge.net.au>
This commit is contained in:
Simon Horman 2013-11-25 10:46:37 +09:00 committed by Willy Tarreau
parent d60d69138b
commit 2f1f955c8c
2 changed files with 19 additions and 0 deletions

View File

@ -7700,6 +7700,10 @@ agent-check
This currently has the same behaviour as "down".
Failure to connect to the agent is not considered an error as connectivity
is tested by the regular health check which is enabled by the "check"
parameter.
Requires the ""agent-port" parameter to be set.
See also the "agent-check" parameter.

View File

@ -228,6 +228,12 @@ static void set_server_check_status(struct check *check, short status, const cha
tv_zero(&check->start);
}
/* Failure to connect to the agent as a secondary check should not
* cause the server to be marked down. So only log status changes
* for HCHK_STATUS_* statuses */
if (check == &s->agent && check->status < HCHK_STATUS_L7TOUT)
return;
if (s->proxy->options2 & PR_O2_LOGHCHKS &&
(((check->health != 0) && (check->result & SRV_CHK_FAILED)) ||
((check->health != s->rise + s->fall - 1) && (check->result & SRV_CHK_PASSED)) ||
@ -608,6 +614,15 @@ static void check_failed(struct check *check)
{
struct server *s = check->server;
/* The agent secondary check should only cause a server to be marked
* as down if check->status is HCHK_STATUS_L7STS, which indicates
* that the agent returned "fail", "stopped" or "down".
* The implication here is that failure to connect to the agent
* as a secondary check should not cause the server to be marked
* down. */
if (check == &s->agent && check->status != HCHK_STATUS_L7STS)
return;
if (check->health > s->rise) {
check->health--; /* still good */
s->counters.failed_checks++;