rportcli

command module
v0.2.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2021 License: MIT Imports: 2 Imported by: 0

README

Rport CLI (v1)

Rport CLI is a tool to help you managing rport API directly from your terminal.

Installation

As a compiled binary

Jump to our release page and download a binary for your host OS. Don't forget to download a corresponding md5 file as well.

# On MacOS
wget https://github.com/cloudradar-monitoring/rportcli/releases/download/v0.0.1pre1/rportcli-v0.0.1pre1-darwin-amd64.tar.gz

# On linux
wget https://github.com/cloudradar-monitoring/rportcli/releases/download/v0.0.1pre1/rportcli-v0.0.1pre1-linux-386.tar.gz

# On Windows
Just download https://github.com/cloudradar-monitoring/rportcli/releases/download/v0.0.1pre1/rportcli-v0.0.1pre1-windows-amd64.zip
Also download https://github.com/cloudradar-monitoring/rportcli/releases/download/v0.0.1pre1/rportcli-v0.0.1pre1-windows-amd64.zip.md5

Verify the checksum:

#On MacOS
curl -Ls https://github.com/cloudradar-monitoring/rportcli/releases/download/v0.0.1pre1/rportcli-v0.0.1pre1-darwin-amd64.tar.gz.md5 | sed 's:$: rportcli-v0.0.1pre1-darwin-amd64.tar.gz:' | md5sum -c

#On linux
curl -Ls https://github.com/cloudradar-monitoring/rportcli/releases/download/v0.0.1pre1/rportcli-v0.0.1pre1-linux-386.tar.gz.md5 | sed 's:$: rportcli-v0.0.1pre1-linux-386.tar.gz:' | md5sum -c
 
#On Windows assuming you're in the directory with the donwloaded file
CertUtil -hashfile rportcli-v0.0.1pre1-windows-amd64.zip MD5

#The output will be :
MD5 hash of tacoscript-0.0.4pre-windows-amd64.zip:
7103fcda170a54fa39cf92fe816833d1
CertUtil: -hashfile command completed successfully.

#Compare the command output to the contents of file rportcli-v0.0.1pre1-windows-amd64.zip.md5 they should match

Note: if the checksums didn't match please skip the installation!

Unpack and install the rportcli binary on your host machine

#On linux/MacOS
tar -xzvf rportcli-v0.0.1pre1-darwin-amd64.tar.gz 
mv rportcli /usr/local/bin/rportcli
chmod +x /usr/local/bin/rportcli

For Windows

  • Extract file contents

  • Create a RportCLI folder in C:\Program Files

  • Copy the rportcli.exe binary to C:\Program Files\RportCLI

  • Double click on the rportcli.exe and allow it's execution

Install as a go binary:

go get github.com/cloudradar-monitoring/rportcli

Config

Rportcli looks for a config file at $HOME/.config/rportcli/config.json (for Linux and MacOS) or C:\Users<CurrentUserName>.config\rportcli\config.json (for Windows). If current user has no home folder, RportCli will look for a config file next to the current binary location.

You can override config path by providing env variable CONFIG_PATH, e.g.

CONFIG_PATH=/tmp/config.json rportcli init

You can generate config by running:

rportcli init

Rportcli will interactively ask for config options and validate the result: You'll get request for following parameters:

server address

address of rport server, e.g. http://localhost:3000

login

basic auth login to access rport server, e.g. admin

password

basic auth password to access rport server, e.g. foobaz

You can skip the interactive wizard by providing parameters as cli options , e.g.

 rportcli init -s http://localhost:3000 -l admin -p foobaz

If you prefer to use environment variables instead you can do the following:

export RPORT_USER=admin
export RPORT_PASSWORD=foobaz
export RPORT_SERVER_URL=http://localhost:3000
#now you can run any rportcli command without config
rportcli client list

You can also use a hybrid variant, where e.g. user and server url are provided as config options and password as an environment variable.

 rportcli init -s http://localhost:3000 -l admin
 export RPORT_SERVER_URL=http://localhost:3000
 rportcli client list

After the config initialisation, Rportcli will check the provided options by calling the rport status API.

Cli

Trigger this command to see all available commands and their options:

rportcli --help

You can also display help for a certain command:

rportcli init --help

Additional configuration with environment variables

Variable Description Default Value Example
CONFIG_PATH Changes default config location to the provided value ${HOME}/.config/rportcli/config.json CONFIG_PATH=/tmp/config.json rportcli init
CONN_TIMEOUT_SEC Connection timeout to call rport server (seconds) 10 seconds CONN_TIMEOUT_SEC=20 rportcli client list
SESSION_VALIDITY_SECONDS initial lifetime of an interactive command session in seconds. Max value is 90 days 10(minutes) * 60 SESSION_VALIDITY_SECONDS=1800 rportcli command -i
RPORT_USER basic auth login to access rport server RPORT_USER=admin rportcli client list
RPORT_PASSWORD basic auth password to access rport server RPORT_PASSWORD=foobaz rportcli client list
RPORT_SERVER_URL address of rport server http://localhost:3000 RPORT_SERVER_URL=http://localhost:3000 rportcli client list

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL