Commando is a tiny tool that enables users to collect command outputs from a single or a multiple networking devices defined in an inventory file.
Install
Using the sudo-less installation script makes it easy to download pre-built binary to the current working directory under cmdo
name:
# for linux and darwin OSes
bash -c "$(curl -sL https://raw.githubusercontent.com/hellt/cmdo/master/get.sh)"
Windows users are encouraged to use WSL, but if it is not possible, the .exe
file can be found in Releases section.
Linux users can leverage pre-built deb/rpm packages that are also available in the Releases section. Either download the package manually, or set --use-pkg
flag with the install script:
bash -c "$(curl -sL https://raw.githubusercontent.com/hellt/cmdo/master/get.sh)" -- --use-pkg
Quickstart
If you want to run commands against multiple devices at once:
- Create an inventory file with the devices information. An example inventory.yml file lists three different platforms.
- Run
./cmdo -i
; the tool will read the inventory file and output the results of the commands in the./ output
directory.
If you want to run commands against a single device:
- Use the CLI flags to define the device and commands to send:
-a
- IP/DNS name of the device
-k
- one of the supported platforms
-u
- SSH credentials-p
-c
- a single or a list of::
-delimited commands
an example command could be:
cmdo -o stdout -a clab-scrapli-srlinux -u admin -p admin -k nokia_srlinux -c "show version :: show system aaa"
Running commands in bulk
As indicated in the quickstart, commando
can run commands against many devices as opposed to the singe-device operation.
For the bulk mode the devices are expressed in the sort-of inventory. The inventory file schema is simple, the network devices are defined under .devices
element with each device identified by
:
devices:
:
:
:
Each device holds a number of options that define the device platform, auth parameters, and the commands to send:
devices:
:
# platform is one of arista_eos, cisco_iosxe, cisco_nxos, cisco_iosxr,
# juniper_junos, nokia_sros, nokia_sros_classic, nokia_srlinux
platform: string
address: string
username: string
password: string
send-commands:
- cmd1
- cmd2
- cmdN
send-commands
list holds a list of commands which will be send towards a device. Check out the attached example inventory file to a reference.
Configuration options
--inventory | -i
- sets the path to the inventory file--add-timestamp | -t
- appends the timestamp to the outputs directory, which results in the output directory to be named likeoutputs_2021-06-02T15:08:00+02:00
.--output | -o value
- sets the output destination. Defaults tofile
which writes the results of the commands to the per-command files. If set tostdout
, will print the commands to the terminal.--filter | -f 'pattern'
- a filter to apply to device name to select the devices to which the commands will be sent. Can be a Go regular expression.
For the single-device operation mode the following flags must be used to define a device:
--address | -a
- address of the device--platform | -k
- one of the supported platform names--username | -u
- username--password | -p
- password--command | -c
- list of commands to send, can be delimited with::
to provide a list of commands
Supported platforms
Commando leverages scrapligo project to support the major network platforms:
Network OS | Platform name |
---|---|
Arista EOS | arista_eos |
Cisco XR/XE/NXOS | cisco_iosxr , cisco_iosxe , cisco_nxos |
Juniper JunOS | juniper_junos |
Nokia SR OS (MD-CLI and Classic) | nokia_sros , nokia_sros_classic |
In addition to that list, commando has the ability to add community provided scrapli drivers, such as:
Network OS | Platform name |
---|---|
Nokia SR Linux | nokia_srlinux |
Attributions
- Bullet icon is made by Smashicons from www.flaticon.com