Passive Health Checks
A passive health check monitors live traffic for errors. You can watch for either failed TCP connections or bad HTTP responses. Passive checks will detect errors returning from any part of your proxied service, but they require active traffic to monitor.
Check for TCP connection errors
To monitor live traffic for TCP connection errors, follow these steps:
Add the
check
parameter to theserver
lines you want to monitor.Add the
observe layer4
parameter to eachserver
line to activate passive health checking.Add the
error-limit
andon-error
parameters to set the threshold for failed passive health checks and the action to take when errors exceed that threshold.
In the following example, we monitor for TCP connection errors. When there are at least 10 of these errors, we mark the server as down by using the mark-down value for the on-error
parameter:
backend servers
server server1 192.168.0.10:80 check inter 2m observe layer4 error-limit 10 on-error mark-down
The
check
parameter enables an active health check probe that will ping the server's TCP port at an interval. The interval is 2s by default and can be changed using theinter
keyword. After a set number of successful active health check probes, this will bring the server back online after it has been removed from the load-balancing rotation from failed passive health checks. In the example above, the interval is increased to 2m to ensure that the server can remain healthy for a longer period of time before returning to service.
Check for HTTP response errors
To monitor live traffic for HTTP response errors, follow these steps:
Add the
check
parameter to theserver
lines you want to monitor.Add the
observe layer7
parameter to eachserver
line to activate passive health checking.Add the
error-limit
andon-error
parameters to set the threshold for failed passive health checks and the action to take when errors exceed that threshold.
In the following example, we monitor for HTTP response errors. When there are at least 10 of these errors, we mark the server as down by using the mark-down value for the on-error
parameter:
backend servers
server server1 192.168.0.10:80 check observe layer7 error-limit 10 on-error mark-down
The
check
parameter enables an active health check probe that will ping the server's TCP port at an interval. After a set number of successful active health check probes, this will bring the server back online after it has been removed from the load-balancing rotation from failed passive health checks.
Set the on-error action
The on-error
parameter on the server
line determines what action to take when errors exceed the threshold you set with the error-limit
. It takes any of the following values:
Action | Description |
---|---|
fastinter | Forces "fastinter" mode, which causes the active health check probes to be sent more rapidly. |
fail-check | Increments one failed active health check and forces "fastinter" mode. |
sudden-death | Simulates a pre-fatal failed check. One more check will mark the server as down. It also forces "fastinter" mode. |
mark-down | Marks the server as down and forces "fastinter" mode. |
Next up
Agent Checks