lbcd

(Report system load for remote load balancing)

SYNOPSIS

lbcd [-dhlRrt] [-c command] [-P file] [-p port] [-T seconds] [-w weight]

lbcd -s [-P file]

DESCRIPTION

lbcd runs as a daemon and reports various system utilization information and optionally service status information via a UDP network protocol. It is designed to run on the client systems of a remote load balancing system, such as the DNS-based lbnamed load balancer.

lbcd supports two different query protocols, version two and version three. (Currently, lbnamed only supports version two queries.) Either will return the current time according to that system, the time of the last system boot, the time the information about logged in users last changed, the load averages (one, five, and fifteen minute), the total and unique logged in users, whether a user is logged in on console, percentage full of the system /tmp directory is full, and percentage full of the system /var/tmp directory. The version three protocol can also return weight and increment information about a set of services.

The service information is based around a model that returns a weight (indicating the current utilization of the box -- the higher, the busier) and an increment (an estimate of how much the utilization will increase for each additional connection directed to this box) which defaults to one. The intent is for the load balancer to query the system periodically, using the returned weight as the system load, and to estimate the system load between queries of lbcd as the last returned weight plus the last returned increment times the number of connections directed to that system. By default, only one service is returned (one minute load).

Since lbnamed calculates the weight from the one minute load and the number of logged-in users and currently only supports version two, lbcd will replace the one-minute load with the weight of the primary service when responding to a version two query.

lbcd responds to any UDP packets on port 4330 (or the port given with the -p option). It has no built-in security, so if you do not want to disclose the above information to random systems on the Internet, you will want to limit access to this port using iptables, firewall rules, or other similar measures.

OPTIONS

-c command

Obtain the service weight and increment by running an external command. This command should print to standard output one line containing two integer numbers, separated by whitespace. The first number is taken to be the weight and the second number is taken to be the increment. (As mentioned above, when responding to version two protocol queries, the weight is returned as the one-minute load average.)

-d

Don't run as a daemon (meaning don't fork and detach from a tty) to make it easier to run lbcd inside a debugger.

-h

Print out usage information and exit.

-l

Currently does nothing. Eventually this will tell lbcd to log all received requests, but this has not yet been implemented.

-P file

Use file to store the PID of the running lbcd process and as the file to read for the -r and -s options, rather than the default of /var/run/lbcd.pid.

-p port

Listen on port rather than the default of 4330.

-R

Use round-robin as the service. This will always return a weight of one and an increment of one. For version two responses, it will always return a one-minute load of one regardless of the actual load average of the system.

-r

Restart a running lbcd process. This stops the existing lbcd process by killing the PID named in /var/run/lbcd.pid or the file given with the -P option and then starts as the new lbcd process.

-s

Stop an existing lbcd process by killing the PID named in /var/run/lbcd.pid or the file given with the -P option.

-T seconds

Use a timeout of seconds when doing service probes (including running a command with -c). The default is five seconds.

-w weight

Specify either a service to probe or a weight and increment to always return. weight can be a string of the form weight:increment where both weight and increment are numbers, in which case that weight and increment will always be returned. Alternately, it can be the name of a service module, in which case that service will be probed and its weight will be returned as the service weight (and the one-minute load with version two queries).

The currently supported services are load (the default), ftp, http, imap, nntp, ntp, pop, smtp, tcp, and rr (round-robin, the same as -R). The http and tcp services must be followed by a colon and a port number.

FILES

/var/run/lbcd.pid

The default location of the PID file. lbcd puts its PID in this file when it starts, and refers to this file for the -r and -s commands. The file location can be changed with -P.

SEE ALSO

lbcdclient(1)

The current version of this program is available from its web page at <http://www.eyrie.org/~eagle/software/lbcd/>.

AUTHORS

Originally written by Roland Schemers and Larry Schwimmer. Currently maintained by Russ Allbery <rra@stanford.edu>.

COPYRIGHT AND LICENSE

Copyright 1993, 1994, 1996, 1997, 1998, 2000, 2003, 2004 Board of Trustees, Leland Stanford Jr. University.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Last spun 2004-11-17 from POD modified 2004-11-16