This section provides an example of constructing a basic version of the pre-defined HTTP health check using a binary health check. This example intends to describe how a binary health check is configured and how it works. It illustrates how the mechanism works and how you can use it to construct an arbitrary TCP service health check.

The HTTP health check essentially issues an HTTP ‘GET’ command and then makes an up/down decision for the server based on the server response code and text. You can construct a similar binary health check (minus the response code checking) that follows the flow below:

Attempt to open a TCP connection to the server IP:port.

The HTTP server should respond and complete the connection; if it does not, it is marked down.

If the connection is successful, LoadMaster sends a ‘GET /index.html’ command to the server.

If the server responds, our health check searches for the text ‘It works!’ in the first 1024 bytes of the response. If this text is found, the server is marked up; otherwise, the server is marked down.

Of course, step 2 above implies that you know how the server responds when the service running on the server is available. If you do not have prior knowledge of how it will respond, It is usually possible to discover this through:

  • Command line interaction with the server.
  • Watching server traffic using a traffic analyzer.

For example, in the case of interacting with an HTTP server as in this example, you can use the telnet command to connect to the server, issue the same GET command as above, and watch what the server returns. The following shows an example of such an exchange:

$ telnet 192.168.150.250 80GET /index.html

<html><body><h1>It works!</h1></body></html>

Connection to host lost.

You type the telnet command; when the connection is made to the server, the screen is reset (usually with character echo turned off). You then type ‘GET /index.html<Enter>’. You must press the Enter key to send the command to the server. The server then sends its response (a small HTML page) and drops the connection.

Not all applications support command line connections and in these cases you can examine client-server traffic in detail by taking a network packet capture using a tool like Wireshark. Continuing with our example above, you could:

  • Run Wireshark to capture network traffic on a system that is connected to the same networks as the client and the server, or on the server itself.
  • Open a browser on a client system to http://192.168.150.250 and wait for the page to display.
  • Stop the packet capture on Wireshark and look for the first packet that has the IP address of the system running the browser you used above as the source IP and the server as the destination IP (in our example, 192.168.150.250). Then, right-click that packet and select Follow > TCP Stream from the drop-down menu that appears. This should open a screen in Wireshark that looks something like this:

The two callouts in the screenshot above highlight the pieces of the conversation between the client (at top) and the server (at bottom) that you need for the binary health check. However, you do not want the ASCII text -- you must convert that to hexadecimal for input into the LoadMaster WUI.

  • You can do this using a few methods:
  • Using the Show data as drop-down in the screen above
  • Using an ASCII to HEX converter (many free converters are available on the web)
  • Using a simple ASCII chart (again, freely available on the web)

For the Data to Send in the binary health check UI example, specify the HEX equivalent of GET /index.html followed by a carriage return and line feed characters (required by an HTTP server to terminate the command line). The table below shows the hexadecimal string at the top and the ASCII string at the bottom:

47

45

54

20

2f

69

6e

64

65

78

2e

68

74

6d

6c

0d

0a

G

E

T

/

I

n

d

e

x

.

h

t

m

l

<CR>

<LF>

Note that each ASCII character is specified by two hexadecimal digits (for example, the letter G is represented by a hexadecimal ‘47’ in the above). No spaces are permitted when you add this to the UI, so the following string is what you copy into the Data to Send text box:

474554202f696e6465782e68746d6c0d0a

Similarly, the hexadecimal Reply Pattern to specify for It works! would be the following:

497420776f726b7321

The screenshot below shows how a binary health check created using the above parameters looks in the UI.