Skip to main content

SSH CLI Documentation

The MetricsHub SSH CLI allows you to execute commands on SSH-enabled devices. When running the CLI, you can choose to authenticate yourself with credentials or a public key and configure additional settings, such as timeout and port.

Before using the CLI, ensure your platform supports SSH monitoring by checking the Supported Platforms.

Syntax​

SSH with Username and Password​

sshcli HOSTNAME --username USERNAME --password PASSWORD --command COMMAND --timeout TIMEOUT --port PORT

SSH with Public Key Authentication​

sshcli HOSTNAME --public-key PATH --command COMMAND --timeout TIMEOUT --port PORT

Options​

OptionDescriptionDefault Value
HOSTNAMEHostname or IP address of the SSH-enabled device. This option is required.None
--usernameUsername for SSH authentication.None
--passwordPassword for SSH authentication. If not provided, you will be prompted interactively.None
--public-keyPath to the public key file for SSH authentication.None
--commandCommand to execute on the remote device.sudo
--timeoutTimeout in seconds for the SSH operation.30
--portPort for the SSH connection.22
-vEnables verbose mode. Use -v for basic logs, -vv for detailed logs.None
-h, --helpDisplays detailed help information about available options.None

Examples​

Example 1: Basic Authentication with Username and Password​

sshcli dev-01 --username admin --password secret --command="echo Hello, World!" --timeout 30 --port 22

Example 2: Authentication with Public Key​

sshcli dev-01 --public-key="/opt/ssh-rsa.txt" --command="ls /home/admin" --timeout 30 --port 22

Example 3: SSH Command with Interactive Password Input​

sshcli dev-01 --username admin --command="whoami"

The CLI prompts for the password if not provided.