mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-16 16:34:42 +00:00
MEDIUM: cli: add support for enabling/disabling health checks.
"enable health" and "disable health" are introduced to manipulate the health check subsystem.
This commit is contained in:
parent
29e50f7507
commit
9b5aecd5be
@ -13154,6 +13154,15 @@ disable frontend <frontend>
|
||||
This command is restricted and can only be issued on sockets configured for
|
||||
level "admin".
|
||||
|
||||
disable health <backend>/<server>
|
||||
Mark the primary health check as temporarily stopped. This will disable
|
||||
sending of health checks, and the last health check result will be ignored.
|
||||
The server will be in unchecked state and considered UP unless an auxiliary
|
||||
agent check forces it down.
|
||||
|
||||
This command is restricted and can only be issued on sockets configured for
|
||||
level "admin".
|
||||
|
||||
disable server <backend>/<server>
|
||||
Mark the server DOWN for maintenance. In this mode, no more checks will be
|
||||
performed on the server until it leaves maintenance.
|
||||
@ -13191,6 +13200,13 @@ enable frontend <frontend>
|
||||
This command is restricted and can only be issued on sockets configured for
|
||||
level "admin".
|
||||
|
||||
enable health <backend>/<server>
|
||||
Resume a primary health check that was temporarily stopped. This will enable
|
||||
sending of health checks again. Please see "disable health" for details.
|
||||
|
||||
This command is restricted and can only be issued on sockets configured for
|
||||
level "admin".
|
||||
|
||||
enable server <backend>/<server>
|
||||
If the server was previously marked as DOWN for maintenance, this marks the
|
||||
server UP and checks are re-enabled.
|
||||
|
@ -1791,7 +1791,23 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
|
||||
sv->agent.state |= CHK_ST_ENABLED;
|
||||
return 1;
|
||||
}
|
||||
if (strcmp(args[1], "server") == 0) {
|
||||
else if (strcmp(args[1], "health") == 0) {
|
||||
struct server *sv;
|
||||
|
||||
sv = expect_server_admin(s, si, args[2]);
|
||||
if (!sv)
|
||||
return 1;
|
||||
|
||||
if (!(sv->check.state & CHK_ST_CONFIGURED)) {
|
||||
appctx->ctx.cli.msg = "Health checks are not configured on this server, cannot enable.\n";
|
||||
appctx->st0 = STAT_CLI_PRINT;
|
||||
return 1;
|
||||
}
|
||||
|
||||
sv->check.state |= CHK_ST_ENABLED;
|
||||
return 1;
|
||||
}
|
||||
else if (strcmp(args[1], "server") == 0) {
|
||||
struct server *sv;
|
||||
|
||||
sv = expect_server_admin(s, si, args[2]);
|
||||
@ -1828,7 +1844,7 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
|
||||
return 1;
|
||||
}
|
||||
else { /* unknown "enable" parameter */
|
||||
appctx->ctx.cli.msg = "'enable' only supports 'agent', 'frontend' and 'server'.\n";
|
||||
appctx->ctx.cli.msg = "'enable' only supports 'agent', 'frontend', 'health', and 'server'.\n";
|
||||
appctx->st0 = STAT_CLI_PRINT;
|
||||
return 1;
|
||||
}
|
||||
@ -1844,6 +1860,16 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
|
||||
sv->agent.state &= ~CHK_ST_ENABLED;
|
||||
return 1;
|
||||
}
|
||||
else if (strcmp(args[1], "health") == 0) {
|
||||
struct server *sv;
|
||||
|
||||
sv = expect_server_admin(s, si, args[2]);
|
||||
if (!sv)
|
||||
return 1;
|
||||
|
||||
sv->check.state &= ~CHK_ST_ENABLED;
|
||||
return 1;
|
||||
}
|
||||
else if (strcmp(args[1], "server") == 0) {
|
||||
struct server *sv;
|
||||
|
||||
@ -1881,7 +1907,7 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
|
||||
return 1;
|
||||
}
|
||||
else { /* unknown "disable" parameter */
|
||||
appctx->ctx.cli.msg = "'disable' only supports 'agent', 'frontend' and 'server'.\n";
|
||||
appctx->ctx.cli.msg = "'disable' only supports 'agent', 'frontend', 'health', and 'server'.\n";
|
||||
appctx->st0 = STAT_CLI_PRINT;
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user