Specifications
Appendix A: Using Server Agents
162 Equalizer Installation and Administration Guide
There is also a pedantic agent flag that tells Equalizer to regard a server as down if there is no
response from the server’s agent. This flag is set in the system parameters, and when it is enabled
it applies to all clusters that have agents. See “Modifying System Parameters” on page 43.
Writing Server Agents
You can write custom agents as shell scripts, or in Perl, C, or other languages.
Equalizer’s agent protocol is extremely simple: when Equalizer connects to the agent’s port, the
agent must respond with an ASCII string (a number that represents the current condition of the
server) and then close the port.
Conditions on the server are inidicated by the agent’s return value as follows:
The code on the following page is a simple server agent example written in Perl. This code prompts
for a constant value when the server agent program is started, and returns that value when a
connection is made on port 1510 (configurable via the
$port variable).
-1 Service is unavailable. Might also be used to indicate that a required resource, such
as a database, is unavailable.
0 to 100 0 indicates that the server is very lightly loaded; 100 indicates that the server is very
overloaded.