Avi Load Balancer can actively disable back-end servers for maintenance. Avi Load Balancer can be configured to use information in the health check responses from servers to detect if a server is in maintenance mode.

Administrators and application developers can use information in the health-check responses from servers to detect if a server is in maintenance mode.

The information can be a specific response code, for instance, HTTP code 503, or a specific response message string, for instance, "Server is under maintenance". Such an event is operationally different from a case where the server process is down due to a software issue. During the time a server is under maintenance, you should not send new connections to the server and should drain the existing connections.

Detecting Maintenance Mode

You can configure some types of health monitors to detect when a server has entered maintenance mode, based on specific response codes or response data contained in the server's responses to health checks. This monitor must be associated with the pool the server is in.

  • Response code — You can configure HTTP and HTTPS health monitors to filter for a specific HTTP response code (101-599). If the code is detected in a server's response to a health check based on the HTTP or HTTPS monitor, Avi Load Balancer changes the server's status to down for maintenance.

  • Response data — You can configure TCP, UDP, HTTP, and HTTPS health monitors to filter for specific data (a response string). If the string is detected in a server's response to a health check based on the HTTP or HTTPS monitor, Avi Load Balancer changes the server's status to down for maintenance. The response data must be within the first 2000 bytes of the response data.

An HTTP or HTTPS health monitor can filter for up to 4 maintenance response codes.

The HTTP and HTTPS health monitors can contain any of the following combinations of filters for detecting a maintenance mode:

  • Response string

  • Multiple response codes

  • Maintenance response string

  • Up to four maintenance response codes

TCP and UDP health monitors can contain a filter for maintenance mode based on either or both of the following:

  • Response string

  • Maintenance response string

Indicating Maintenance Mode

When Avi Load Balancer detects that a server has entered maintenance mode, the server's health status is changed to down for maintenance.

When a server is marked down for maintenance, the existing connections to the server are left untouched and are allowed to close on their own. Avi Load Balancer continues to send health checks to the server. When the server stops responding with the maintenance string or code, this indicates to Avi Load Balancer that the maintenance mode has concluded, and changes the server's health status to up.

Similarly, the server's change into and back out of maintenance mode is indicated in the event log.

Configuring a Health Monitor To Detect Server Maintenance Mode

Web Interface

The following are the steps to configure web interface to detect server maintenance mode:

  1. Navigate to the configuration popup of the health monitor:

    1. Navigate to Templates > Health Monitor.

    2. Click the edit icon next to the name of the health monitor.

  2. Click Create button to create a new health monitor. Specify a name, and select the monitor type, such as TCP or UDP for layer 4, HTTP or HTTPS for layer 7.

  3. In the Server Maintenance Mode section, specify the response code(s) or data to use as the indicator that a server is in maintenance mode.

  4. Click Save.

Example HTTPS Health Monitor with Maintenance Mode Detection



Example TCP Health Monitor with Maintenance Mode Detection



Attaching a Health Monitor to a Pool

The health monitor is used only for the pools the monitor is attached to.

To attach a health monitor to a pool,

  1. Navigate to Applications > Pools.

  2. Click Create button.

  3. Select the monitor by clicking Add Active Monitor button. The drop-down list displays the list of health monitors.

  4. Select the required health monitor option.



CLI

The following commands configure an HTTP health monitor to filter for the string under construction in health-check responses from servers:

: > configure healthmonitor System-HTTP
: healthmonitor> http_monitor
: healthmonitor:http_monitor> maintenance_response "under construction"
: healthmonitor:http_monitor> save
: healthmonitor> save 

The following commands configure the same HTTP health monitor to filter for response codes 500 and 501 in health-check responses from servers. The following commands configure an HTTP health monitor to filter for the string under construction in health-check responses from servers:

: > configure healthmonitor System-HTTP : healthmonitor> http_monitor : healthmonitor:http_monitor> maintenance_code 500 : healthmonitor:http_monitor> maintenance_code 501 : healthmonitor:http_monitor> save : healthmonitor> save 

The following commands edit the health monitor's configuration to remove the filter a response string:

: > configure healthmonitor System-HTTP
: healthmonitor> http_monitor
: healthmonitor:http_monitor> no maintenance_response
: healthmonitor:th> save
: healthmonitor> save 

Avi Load Balancer makes no assumptions.