Failover Shell Tcl Extension

To define a service, one has to provide Tcl scripts to start, stop and reclaim the service. These scripts must return the new state to the caller. Note that if you start or stop a service from outside of failsh, you must use the failc utility to tell faild that the state of a service has changed.

The Tcl commands

Failsh is a Tcl application. At startup it reads the Tcl script given as argument to the -f option, and executes it. Three new commands failsvc, failhost and failtrap have been added to the Tcl interpreter. They are used to define various parameters of a service or a host, i.e. the service name, list of masters and slaves, the start, stop and reclaim procedures and the heartbeat interval. This is the interval after which a service is run, i.e. all the masters and slaves are queried for their state and it is decided whether the local state needs to be changed. Failsh contains a simple scheduler that is distantly modeled after the Unix scheduler and takes care of running the services at the specified intervals.

The failhost command.

The failhost command defines a host. It is only used if the host has individual parameters like a different port or protocol. Otherwise hosts are implicitely defined when their names appear in a list of masters or slaves. The syntax for the port subcommand is
failhost hostname port portnum
This requests that the port number portnum be used when connecting to this particular host. This is only used if the firewall friendly mode is used.

The protocol subcommand allows to specify the protocol, which should be used when calling this host. It has the following syntax:

failhost hostname protocol protocol
protocol can either be a udp or tcp, and defaults to TCP.

The failsvc command.

The failsvc command has a the following syntax:
failsvc service subcommand args
The following subcommands are defined
interval
Specify the interval, after which the server should be queried to verify the state.
masters
Specify the list of master hosts.
slaves
Specify the list of slave hosts.
start
Specify the Tcl procedure that should be called when starting the service.
stop
Specify the Tcl procedure that should be called when stoping the service.
reclaim
Specify the Tcl procedure that should be called when reclaiming the service.

The failtrap command

The failtrap command has the following syntax:
failtrap subcommand parameter
The following subcommands are understood:
host
This is the name of the host to send traps to. If you don't specify a host, traps are not enabled.
port
If a port argument is specified, traps are sent to this port instead of the standard port 162 used for SNMP traps.
enterprise
use this string as the enterprise identifier in the SNMP trap. If you set the enterprise oid using this command, you will also have to set the prefix for the variables, or the trap message will not be consistent.
prefix
use this as the object identifier prefix for the SNMP variables communicated in the trap. You will normally want to use the same string as for the enterprise field. However, this is not the default and you have to explicitly set the prefix if you set the enterprise oid. community use parameter as the community string (for authentication). The default is ``public''.

Running failsh

Failsh must be running continuously to notice any state changes and take appropriate action. For this reason, failsh can be run in the foreground using the -F option, facilitating running it from init(8). If this is done, care should be taken that the Tcl script takes care that the services are correctly brought the RECOVER state when failsh restarts, and lets only failsh bring up a service.
© 1999 Andreas Müller
$Id: tcl-extension.html,v 2.0 2000/09/09 19:27:46 afm Exp $