NAME
tentakel - distributed command execution
SYNOPSIS
tentakel [ -lhv ] [ -c file ] [
-g group ] [ command ]
DESCRIPTION
tentakel is a program for executing the
same command on many hosts in parallel using various remote
methods.
It can make use of several sets of hosts that are defined in a
configuration file as groups.
The command is executed in parallel on all hosts in this group.
By default, every result is printed to stdout. The output format
can be defined for each group.
If no command is specified tentakel goes into interactive
mode which can be used for repeated commands.
The requirements on the remote hosts depend on the selected
remote method. The ssh method, for example, needs a running
sshd on the remote side. tentakel itself only needs to be
installed on the controlling host.
OPTIONS
- -c file
- Use file as the configuration file if specified,
otherwise try $HOME/.tentakel/tentakel.conf and finally
/etc/tentakel.conf.
- -g groupname
- Select the group groupname The group must be defined in
the configuration file. If not specified tentakel
implicitely assumes the lqdefaultrq group.
- -l
- Display a list of possible group choices.
- -h
- Display a brief help message.
- -v
- Display version information.
- command
- The command that is to be executed on all hosts in the current
group. If command is omitted, tentakel starts in
interactive mode.
CONFIGURATION FILE
Everything appearing after a # character
will be ignored to the next newline. Leading whitespace will be
ignored. Host and List objects become members of the last named
group declaration. Forward declarations are allowed.
In the first section you may set global variables like:
set var="value"
value must be enclosed in double quotes even if it does
not contain spaces. To write the double quote characters itself in
the value, you have to write two successive double quote
characters, e. g. var="foo(""bar"")".
var must be one of the following:
- ssh_path
- The path where the ssh(1) binary
is located.
- rsh_path
- The path where the rsh(1) binary
is located.
- method
- You can choose between "ssh" and "rsh" (ssh is the default). A
user may define additional methods by creating plugins, as
explained later.
- user
- The user that is used to login to the remote host. If no user
is specified, the effective uid of the tentakel process is
used.
- format
- The format controls how the output of the remote command is
formatted. Most of the characters in format are output
verbatim while some character sequences are treated special:
-
- \\
- prints a literal \ character.
- \n
- prints a newline character.
- \t
- prints a tab character.
- %c
- Denotes a formatting expression that is expanded dynamically.
Formatting expressions consist of a % followed by a single
character c and are expanded depending on the value of c while c
can be one of:
-
- %
- a literal % character.
- d
- expanded to the name of the destination (ip or hostname).
- o
- expanded to the output of the remote command.
- s
- expanded to the exit status of the remote command.
- t
- expanded to the time (in seconds) that was needed to execute
the remote command. This includes the time for network overhead
etc.
The default format is "### %d(stat: %s, dur(s):
%t):\n%o\n".
- maxparallel
- Run at most maxparallel commands in parallel. This is
useful to avoid, for example, a command overloading a download
server. "0" means no limit (default). Setting it to "1" is more or
less senseless.
Group Definition
Definitions of groups make up the second
section of the configuration file. A new group is defined by a
group statement of the form:
group name ( [ param1 [, param2 ... ] ] )
members
name must consist only of alphanumeric characters.
Inside the parentheses you can specify variables that follow the
same rules as the variables in the first section of the
configuration file. Those parameters override the global parameters
for this specific group. Parameters of sub-groups override those
set in the enclosing group. An exception from this rule is the
maxparallel parameter, whose value is always taken from the
outermost group.
Group Members
A group definition ends with a
whitespace-separated list of its members. Each item takes the form
of:
- [ + | @ ] name
name must consist of alphanumeric characters but is
additionally allowed to contain dots. Each name is prepended by a
type designator which specifies the members type. Possible types
are:
-
- +name
- Host inclusion. name is included and can be an ip
address or a hostname.
- @name
- Group inclusion. All members of group name are included.
Forward declarations are allowed.
Configuration File Example
set ssh_path="/usr/bin/ssh"
group myGroup (method="ssh", user="stark") +localhost @others
group others () +hostA +hostB +hostC
For more examples please see the example configuration file.
PLUGINS
The set of remote methods tentakel can use to
execute commands can be extended by means of plugins. A plugin is a
single Python module and must appear in the
$HOME/.tentakel/plugins/ directory. Inside a plugin an arbitrary
number of subclasses of the RemoteCommand class may be defined.
Each class corresponds to one remote method.
By registering a plugin the set of possible choices for the
method parameter can be extended.
For further information please refer to the PLUGINS document
which should be contained in your tentakel installation.
INTERACTIVE MODE
The interactive mode has several
advantages:
- -
- it's easier if more than one command needs to be executed
- -
- you can leave out some quoting for the command
- -
- the current configuration can be changed interactively
The following commands are available in interactive sessions:
- help command
- Display a brief help message on command.
- listgroups
- Display a list of available groups.
- use groupname
- Set the current group to groupname.
- hosts
- Display a list of affected hosts.
- exec command
- Execute command on all affected hosts.
- conf
- Change the current configuration interactively. The default
editor command is /usr/bin/vi but can be overridden by setting
either of the VISUAL or EDITOR environment variables.
Using the conf command does only affect the configuration of
the running interactive tentakel process. It does not change any
configuration file.
- quit
- Exit tentakel. The same can be done by pressing ctrl-d.
If the (3)
library is installed on the system you can use the tab key for
automatic completion of partially entered command names.
EXAMPLES
$ tentakel -g myGroup uptime
This command executes the uptime(1)
command on all hosts defined in group myGroup. The whole
output (even stderr) of each host is printed according to the
format string.
FILES
- /etc/tentakel.conf
- Site-wide configuration file.
- $HOME/.tentakel/tentakel.conf
- User-specific configuration file.
- $HOME/.tentakel/plugins/
- User-defined remote method plugins
The user-specific configuration file takes precedence over the
site-wide one.
BUGS
tentakel uses threads. This restricts the usage
to platforms that have a working threads implementation supported
by Python.
Currently, ssh(1) and
rsh(1) are
the only supported remote methods.
REPORTING BUGS
Please visit http://tentakel.biskalar.de/.
There you will find up-to-date information about how to report
bugs.
AUTHOR
Written by Sebastian Stark and Marlon Berlin.
SEE ALSO
ssh(1),
rsh(1),