HAProxy Enterprise Documentation 1.9r1

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:

  1. Add the check parameter to the server lines you want to monitor.

  2. Add the observe layer4 parameter to each server line to activate passive health checking.

  3. Add the error-limit and on-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  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. 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.

Check for HTTP response errors

To monitor live traffic for HTTP response errors, follow these steps:

  1. Add the check parameter to the server lines you want to monitor.

  2. Add the observe layer7 parameter to each server line to activate passive health checking.

  3. Add the error-limit and on-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