sample script to ssh to multiple devices

48 views
Skip to first unread message

trigger-man

unread,
Aug 22, 2014, 10:37:34 PM8/22/14
to trigge...@googlegroups.com
Does anyone have a sample script that SSHs into multiple devices and grab some output. have been using Paramiko, but want to try out if trigger. Thanks in advance.

Jathan McCollum

unread,
Sep 4, 2014, 2:15:22 AM9/4/14
to trigge...@googlegroups.com
Heya-

Trigger has a bundled tool called "run_cmds" that does exactly this. It can SSH/telnet to any number of devices that you specify and run any commands you specify! 

$ run_cmds -h
Usage: run_cmds [options]

Run commands on network devices.

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -d DEVICES, --devices=DEVICES
                        Comma-separated list of devices.
  -c CONFIG, --config=CONFIG
                        Comma-separated list of config statements.  If your
                        commands have spaces, either enclose the command in "
                        or escape the spaces with \
  -D DEVICE_FILE, --device-file=DEVICE_FILE
                        Specify file with list of devices.
  -C CONFIG_FILE, --config-file=CONFIG_FILE
                        Specify file with list of config statements.  The file
                        MUST be in a tftp directory (/home/tftp/<subdir>). The
                        fully-qualified path MUST be specified in the
                        argument. Do NOT include "conf t" or "wr mem" in your
                        file. ** If both -c and -C options specified, then -c
                        will execute first, followed by -C
  -p DEVICE_PATH, --device-path=DEVICE_PATH
                        Specify dir with a file named for each device.
                        Contents of each file must be list of commands. that
                        you want to run for the device that shares its name
                        with the file. ** May NOT be used with -d,-c,-D,-C **
  -q, --quiet           suppress all standard output; errors/warnings still
                        display.
  -j JOBS, --jobs=JOBS  maximum simultaneous connections (default 5).
  -t TIMEOUT, --timeout=TIMEOUT
                        Time in seconds to wait for each command to
                        complete (default 30).
  -v, --verbose         verbose output.
  -V, --debug           debug output.
  --push                actually do stuff.  Default is False.


On Fri, Aug 22, 2014 at 7:37 PM, trigger-man <manikanda...@gmail.com> wrote:
Does anyone have a sample script that SSHs into multiple devices and grab some output. have been using Paramiko, but want to try out if trigger. Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "Trigger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trigger-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Jathan.
--
Reply all
Reply to author
Forward
0 new messages