Use the "check" keyword to enable health-check support. Note that the
health-check is disabled by default and must be enabled independently from
- the server using the "enable health" command.
+ the server using the "enable health" command. For agent checks, use the
+ "agent-check" keyword and the "enable agent" command. Note that in this case
+ the server may be activated via the agent depending on the status reported,
+ without an explicit "enable server" command. This also means that extra care
+ is required when removing a dynamic server with agent check. The agent should
+ be first deactivated via "disable agent" to be able to put the server in the
+ required maintenance mode before removal.
Here is the list of the currently supported keywords :
+ - agent-addr
+ - agent-check
+ - agent-inter
+ - agent-port
+ - agent-send
- allow-0rtt
- alpn
- addr
static struct srv_kw_list srv_kws = { "CHK", { }, {
{ "addr", srv_parse_addr, 1, 1, 1 }, /* IP address to send health to or to probe from agent-check */
{ "agent-addr", srv_parse_agent_addr, 1, 1, 1 }, /* Enable an auxiliary agent check */
- { "agent-check", srv_parse_agent_check, 0, 1, 0 }, /* Enable agent checks */
+ { "agent-check", srv_parse_agent_check, 0, 1, 1 }, /* Enable agent checks */
{ "agent-inter", srv_parse_agent_inter, 1, 1, 1 }, /* Set the interval between two agent checks */
{ "agent-port", srv_parse_agent_port, 1, 1, 1 }, /* Set the TCP port used for agent checks. */
{ "agent-send", srv_parse_agent_send, 1, 1, 1 }, /* Set string to send to agent. */
goto out;
}
- /* Init check if configured. The check is manually disabled because a
- * dynamic server is started in a disable state. It must be manually
- * activated via a "enable health" command.
+ /* Init check/agent if configured. The check is manually disabled
+ * because a dynamic server is started in a disable state. It must be
+ * manually activated via a "enable health/agent" command.
*/
if (srv->do_check) {
if (init_srv_check(srv))
srv->check.state &= ~CHK_ST_ENABLED;
srv_use_dynsrv(srv);
}
+ else if (srv->do_agent) {
+ if (init_srv_agent_check(srv))
+ goto out;
+
+ srv->agent.state &= ~CHK_ST_ENABLED;
+ srv_use_dynsrv(srv);
+ }
/* Attach the server to the end of the proxy linked list. Note that this
* operation is not thread-safe so this is executed under thread
if (!start_check_task(&srv->check, 0, 1, 1))
ha_alert("System might be unstable, consider to execute a reload");
}
+ else if (srv->agent.state & CHK_ST_CONFIGURED) {
+ if (!start_check_task(&srv->agent, 0, 1, 1))
+ ha_alert("System might be unstable, consider to execute a reload");
+ }
ha_notice("New server registered.\n");
cli_msg(appctx, LOG_INFO, usermsgs_str());
if (srv->check.state & CHK_ST_CONFIGURED)
free_check(&srv->check);
+ else if (srv->agent.state & CHK_ST_CONFIGURED)
+ free_check(&srv->agent);
/* remove the server from the proxy linked list */
if (be->srv == srv) {
/* stop the check task if running */
if (srv->check.state & CHK_ST_CONFIGURED)
check_purge(&srv->check);
+ else if (srv->agent.state & CHK_ST_CONFIGURED)
+ check_purge(&srv->agent);
/* detach the server from the proxy linked list
* The proxy servers list is currently not protected by a lock, so this