Programs written in Python - v0.1, concurrent SSH command execution and file/dir copying onto remote hosts. Requires Paramiko Python extension.

Usage: cssh [options] IP1 hostname2 IP3 hostname4 ...

(IPs/hostnames on the commandline are actually optional, they can be specified in the file, see below.)

-h, --help            show this help message and exit
-c CMD, --cmd=CMD     Command to run. Mutually exclusive with -s.
-s SCRIPT, --script=SCRIPT
                        Script file to run remotely. Mutually exclusive with
                        -c. Script can have its own arguments, specify them in
                        doublequotes, like "script -arg arg".
-y COPY, --copy=COPY Distribute the local file / directory to remote hosts
                        (concurrently of course). Directory will be copied
-g REMOTEDIR, --remote-dir=REMOTEDIR
                        The directory where file or dir will be copied /
                        script will be copied and executed. Defaults to /tmp
                        for executed scripts (note that some system
                        administrators set noexec attribute on /tmp's
                        filesystem, which would prevent execution of the
                        script there).
-a, --cleanup         Delete the script on remote hosts after executing it.
-f FILE, --file=FILE File with hosts to use, one host per line.
                        Concatenated with list of hosts/IP addresses specified
                        at the end of the commandline. Optionally, in a line
                        of the file you can specify sequence:
                        "Address/Hostname Username Password SSH_Port"
                        separated by spaces (additional parameters can be
                        specified on a subset of lines; where not specified,
                        relevant parameters take default values).
-i IPSET, --ipset=IPSET
                        A named set of IPs/Hostnames to use, configured in the
                        resource file (~/.cssh.rc by default).
-d DIR, --dir=DIR     Directory for storing standard output and standard
                        error of command. If specified, directory will be
                        created, with subdirs named IPs/hostnames and relevant
                        files stored in those subdirs.
-u USERNAME, --username=USERNAME
                        Username to specify for SSH. Defaults to 'root'.
-p PASSWORD, --password=PASSWORD
                        Password. Password is used first; if connection fails
                        using password, cssh uses SSH key (default or
-o PORT, --port=PORT Default SSH port.
-k KEY, --key=KEY     SSH Key file. Defaults to /root/.ssh/id_dsa.
-n, --nokey         Turns off using SSH key.
-t TIMEOUT, --timeout=TIMEOUT
                        SSH connection timeout. Defaults to 20 seconds.
                        Maximum number of threads working concurrently.
                        Default is 100. Exceeding 200 is generally not
                        recommended due to potential exhaustion of address
                        space (each thread can use 10 MB of address space and
                        32-bit systems have a maximum address space of 4GB).
                        Resource file to use. Defaults to ~/.cssh.rc. Mutually
                        exclusive with -e.
                        Don't use any resource file. Mutually exclusive with
-m, --monochromatic Do not use colors while printing output.
-w WAIT, --wait=WAIT Each thread that has sucessfully opened SSH connection
                        waits for specified number of seconds after command or
                        script has been executed. This is intended to let the
                        long-running command complete, for example
                        reboot/shutdown commands on some operating systems do
                        not like immediate termination of SSH connection after
                        the command has been issued.
-q, --quiet         Quiet. Do not print out summaries like IPs for which
                        communication succeeded or failed, etc. - v0.2, analyzes Exim logs and outputs mail traffic graphs (incoming + outgoing)


  • Python 2.4 or later
  • Gnuplot 4.0 or later
  • Notes:

  • v0.2 now needs ~15MB of RAM for 200MB of logs (YMMV, etc). This is because matching log lines are kept in memory.
  • It's tested on Debian Etch Linux, if it doesn't work on your (relatively popular) platform, drop me a note at admin at
  • The script outputs daily graphs and a combined graph (for all logs).
  • It also produces html file (name 'configured-fname.html', or 'mailgraph.html' by default) with links to all the graphs in the output dir.
  • Configuration via editing parameters at the beginning of the script.
  • Data is normalized by deleting data points 3 standard deviations away from mean and smoothed with csplines.
  • Bugfixes:

  • v0.2.1 - fixed issue with too small datasets, thanks to Jonas Meyer for helping out with this
  • v0.1 was leaving temporary file in /tmp, now it's deleted, please update
  • memory usage improvements, the program needs a lot less memory now, thanks to Derrick MacPherson for testing
  • Example graph: mailgraph_2007-11-16_all_logs.png

    More examples:


    ./ --help - generate mail traffic graphs using Exim logs.

    (just run it with no options)

    Defaults (set them by editing the program file):

    graphlen     = 1024
    graphheight    = 768
    logdir         = /var/log/exim
    mail_regexp    = virtual_localdelivery|local_delivery|remote_smtp
    outputdir     = /var/www/html
    fname         = mailgraph
    labelnum     = 11
    gnuplot        = ['/usr/bin/gnuplot', '/usr/local/bin/gnuplot']

    This page is hosted by Domeny.PL.