NAME
cshelper - Find the best machine via SNMP to run a command on.
SYNOPSIS
cshelper [-d] [-p] [-e <enviroment>] [-h <hosts.ini>] [-c <config.ini>] [-m <method>] <command>
DESCRIPTION
This figures out the host to run the command on via polling the configured hosts via SNMP. The current methods below are currently supported are as below.
load_1m - Find the machine with the lowest 1m load.
ram_used_percent - Find the machine with the lowest used percent of RAM.
ARGS
-d
Print the command to run and then exit with out running it.
-p
Print the command before running it.
-e <enviroment>
Run with a altered enviroment.
This will used the specified section in the config INI file to build a /usr/bin/env command with to use to run the specified command.
-h <hosts.ini>
The hosts INI config file to use.
-c <config.ini>
The config INI file to use.
-m <method>
Use this method instead of default method.
CONFIGURATION
CONFIG.INI
The default one is ~/.config/cluster-ssh-helper/config.ini .
Below is a basic example.
snmp=-v 2c -c public
snmp
This is the additional args to pass to snmpget for auth.
method
This is default method to use for selecting the what host to run the command on. If not specified, 'load' is used.
load_1m , checks 1 minute load and uses the lowest
ram_used_percent , uses the host with the lowest used percent of RAM
ssh
The default command to use for SSH.
If not specified, just 'ssh' will be used.
This should not include either user or host.
ssh_user
If specified, this will be the default user to use for SSH.
If not specified, SSH is invoked with out specifying a user.
env
If specified, '/usr/bin/env' will be inserted before the command to be ran.
The name=values pairs for this will be built using the hash key specified by this.
warn_on_poll
Issue a warn() on SNMP timeouts or other polling issues. This won't be a automatic failure. Simply timing out on SNMP means that host will be skipped and not considered.
This defaults to 1, true.
HOSTS.INI
The default one is ~/.config/cluster-ssh-helper/config.ini .
This contains the hosts to connect to. The same variables can be used as from the config. Anything specified for a use will override the one in config.
Below is a example configuration with 3 hosts in it, with the second one having a different SNMP auth then the other two.
[127.0.0.1]
[a.foo.bar]
snmp=-v 2c -c k3k3kqwdq
[b.foo.bar]