Skip to content
LabTether

labtether-cli

Command-line interface for the LabTether hub API.

Installation

Download the binary for your platform from the releases page, or build from source:

git clone https://github.com/labtether/labtether-cli
cd labtether-cli
go build -o labtether-cli .

Configuration

# Set hub URL and API key
labtether-cli config set-host https://hub.local:8443
labtether-cli config set-key

# For a hub with a private CA, trust the verified CA certificate
labtether-cli config set-ca /path/to/hub-ca.crt

# Verify
labtether-cli config show
labtether-cli whoami

Configuration is stored in ~/.config/labtether/config.json. set-key reads the key at a hidden prompt, or from standard input. Do not put the key in a command argument. For automation, use a protected file:

labtether-cli --api-key-file /path/to/api-key whoami

On Unix, the key file must have permissions 0600.

Environment Variables

Variable Description Priority
LABTETHER_HOST Hub URL Flag > Env > Config
LABTETHER_API_KEY API key Protected file flag > Env > Config
LABTETHER_TLS_CA_FILE Additional PEM CA certificate bundle Flag > Env > Config

Global Flags

Flag Description
--host Override hub URL
--api-key-file Read the API key from a protected file
--tls-ca-file Trust an additional PEM CA certificate bundle
--json Machine-readable JSON output

--api-key is rejected because command arguments can expose secrets in shell history and process lists. Non-loopback Hub URLs must use HTTPS.

Exit Codes

Code Meaning
0 Success
1 Command failed
2 Authentication error (401/403)
3 Asset offline or not found (409/404)
4 Configuration error

Commands

Assets

labtether-cli assets list              # List all assets
labtether-cli assets list --online     # Online only
labtether-cli assets get server1       # Asset details

Command Execution

# Single target
labtether-cli exec server1 "df -h"
labtether-cli exec server1 "journalctl -u nginx -n 100" --timeout 120

# Multi-target
labtether-cli exec --targets server1,server2 "uptime"
labtether-cli groups list                                # the ID column has each group's ID
labtether-cli exec --group <group-id> "systemctl status nginx"

--group takes a group ID from groups list, not the group's name.

By default LabTether runs only read commands: uptime, uname, df, du, free, ps, top, journalctl, systemctl status, docker ps, docker images, ls, cat, grep, tail and head, plus a few Windows ones such as whoami, systeminfo and tasklist. It refuses other commands, such as apt update or nginx -t, and shell operators such as |, ; and >.

Services

labtether-cli services list server1
labtether-cli services restart server1 nginx
labtether-cli services stop server1 postgres

Files

labtether-cli files ls server1 .
labtether-cli files cat server1 notes.txt

By default the agent allows only its user's home directory, and relative paths start there. Paths such as /etc need the device's Files Root Mode agent setting set to full.

Docker

labtether-cli docker hosts
labtether-cli docker ps docker-host1
labtether-cli docker restart container-id
labtether-cli docker logs container-id --tail 100

System Info

labtether-cli net server1
labtether-cli disks server1
labtether-cli ps list server1
labtether-cli packages list server1

Power

labtether-cli reboot server1
labtether-cli shutdown server1
labtether-cli wake server1

Monitoring

labtether-cli alerts list
labtether-cli alerts ack alert-id
labtether-cli incidents list
labtether-cli metrics overview

Infrastructure

labtether-cli proxmox cluster-status
labtether-cli proxmox resources
labtether-cli truenas pools nas1
labtether-cli pbs datastores backup1

Other

labtether-cli groups list
labtether-cli search nginx
labtether-cli audit
labtether-cli hub status
labtether-cli topology blast-radius server1
labtether-cli discovery run

JSON Output

Read and action commands support --json for the Hub's data payload:

labtether-cli assets list --json | jq '.[] | select(.status == "online")'
labtether-cli exec server1 "uptime" --json

Other read commands already return JSON. Configuration changes return a small status object. Failures return a nonzero exit code and an error object if no result was already printed. A failed remote exec keeps its result and nonzero exit code; always check the exit code.

files cat always streams the original file bytes and docker logs always prints log text, even when --json is set. Their errors stay on standard error.