Skip to main content

ServiceRadar CLI

The srctl command-line tool bundles the day-to-day administrative operations for a ServiceRadar deployment: hashing admin passwords, generating certificates and JWT keys, managing edge onboarding packages, bootstrapping NATS, and authenticating via device-code flow.

Where the binary lives​

The CLI ships as the serviceradar-cli package and installs the binary at /usr/local/bin/srctl. In Kubernetes deployments it is available in the ServiceRadar tools pod. On standalone hosts (core, gateway, agent), it is installed alongside the service it administers.

Rename note: the binary was renamed from serviceradar-cli to srctl. The DEB/RPM packages and tools/config-updater images also provide a serviceradar-cli compatibility symlink, which is deprecated and will be removed in a future release. Use srctl in new scripts and automation.

Examples in this page use srctl as the command name. The separate JavaScript CLI retains the serviceradar-cli name for dashboard and plugin workflows. The capture subcommand is not included; it depends on the remote packet-capture session, RBAC, and audit support.

Run with no subcommand and no arguments to launch an interactive TUI; run with -help for the built-in usage summary.

Default mode: bcrypt password hashing​

With no subcommand, the CLI generates a bcrypt hash, used for the admin password in core.json. Bcrypt cost defaults to 12.

# Hash a password passed as an argument
srctl mypassword

# Hash a password read from stdin
echo mypassword | srctl

# Launch the interactive TUI (no args, attached terminal)
srctl

When input is piped or an argument is supplied, the CLI runs non-interactively and prints the hash. Feed the result into update-config.

update-config​

Writes a new admin password hash into core.json.

srctl update-config \
-file /etc/serviceradar/core.json \
-admin-hash '$2a$12$...'
FlagDescription
-filePath to the core.json config file.
-admin-hashBcrypt hash for the admin user.

update-gateway​

Adds or removes service checks in gateway.json.

# Add a checker
srctl update-gateway -file /etc/serviceradar/gateway.json -type sysmon

# Remove a checker
srctl update-gateway -file /etc/serviceradar/gateway.json -action remove -type sysmon

# Enable all standard checkers
srctl update-gateway -file /etc/serviceradar/gateway.json -enable-all
FlagDescription
-filePath to gateway.json.
-actionadd or remove (default add).
-agentAgent name in gateway.json (default local-agent).
-typeService type (e.g. sysmon, rperf-checker, snmp).
-nameService name (defaults to the service type).
-detailsService details, e.g. IP:port for gRPC checkers.
-enable-allEnable all standard checkers.

generate-tls​

Generates the mTLS certificate set used by ServiceRadar services.

srctl generate-tls -ip 192.168.1.10,10.0.0.5
srctl generate-tls --non-interactive # uses 127.0.0.1
srctl generate-tls --add-ips -ip 10.0.0.5 # extend existing certs
FlagDescription
-ipComma-separated IP addresses to include in the certificates.
-cert-dirOutput directory (default /etc/serviceradar/certs).
-add-ipsAdd IPs to existing certificates instead of regenerating.
-non-interactiveRun unattended using 127.0.0.1.

generate-jwt-keys​

Generates an RS256 keypair for signing API JWTs and updates core.json.

FlagDescription
-filePath to core.json (default /etc/serviceradar/config/core.json).
-kidKey ID embedded in the JWT header (auto-derived by default).
-bitsRSA key size in bits (default 2048).
-forceOverwrite existing RS256 keys if present.

spire-join-token​

Requests a SPIRE join token from the core API, and optionally registers a downstream (nested) SPIRE server entry.

srctl spire-join-token \
-core-url https://core.example.serviceradar.cloud \
-api-key "$SERVICERADAR_API_KEY" \
-downstream-spiffe-id spiffe://example.dev/ns/demo/gateway-nested-spire \
-selector unix:uid:0 -selector unix:gid:0
FlagDescription
-core-urlCore API base URL (default http://localhost:8090).
-api-key / -bearerCredentials for authenticating with core.
-ttlJoin token TTL in seconds.
-agent-spiffe-idOptional alias SPIFFE ID for the agent.
-no-downstreamSkip registering a downstream entry.
-downstream-spiffe-idSPIFFE ID for the downstream gateway SPIRE server.
-selectorDownstream selector; repeatable.
-x509-ttl / -jwt-ttlDownstream SVID TTLs in seconds.
-dns-name / -federates-withDownstream DNS names / federated trust domains; repeatable.
-outputWrite the response JSON to a file.

enroll​

Enrolls an edge agent or collector against core using an onboarding token (edgepkg-v3 or collectorpkg-v2). This writes the agent/collector config and fetches certificates.

srctl enroll -token "<onboarding-token>"
FlagDescription
-tokenEnrollment token.
-core-urlExplicit HTTPS Core API base URL. When supplied, it overrides the URL embedded in the signed token; otherwise the embedded URL is used.
-host-ipOverride the detected host IP (agent enrollment).
-configAgent config path (default /etc/serviceradar/agent.json).
-config-dir / -config-fileCollector config directory / filename.
-cert-dirCertificate directory (default /etc/serviceradar/certs).
-creds-dirCollector credentials directory (default /etc/serviceradar/creds).
-forceOverwrite existing config/certs.
-ca-fileCA bundle for verifying the core API TLS certificate.

See Edge Agent Onboarding for the end-to-end flow.

edge package — onboarding package management​

The edge package command group manages onboarding packages issued by core. These packages produce the tokens consumed by enroll.

srctl edge package create --label "site-a-gateway" --component-type gateway
srctl edge package list
srctl edge package show --id <package-id>
srctl edge package download --id <package-id> --download-token <token>
srctl edge package revoke --id <package-id>
srctl edge package token --id <package-id> --download-token <token>
srctl edge package mtls --label "macbook-01"
SubcommandPurpose
createIssue a new onboarding package and emit the structured token.
listList packages, with filters for status, component type, gateway, etc.
showDisplay detailed information for a package.
downloadDownload onboarding artifacts as tar.gz or JSON.
revokeRevoke a package and its downstream entry.
tokenEmit a signed edgepkg-v3 token for an existing package.
mtlsShorthand for create with checker:sysmon-osx and mTLS defaults.

All edge package subcommands accept --core-url, --api-key/--bearer for authentication, and --output text|json. Key flags for create:

FlagDescription
--labelDisplay label for the package (required).
--component-typegateway, agent, or checker[:kind] (default gateway).
--component-idOptional component identifier override.
--parent-type / --parent-idParent component type and identifier.
--gateway-idGateway identifier override.
--siteSite/location note.
--metadata-json / --metadata-fileMetadata JSON payload.
--selectorSPIRE selector; repeatable.
--join-ttl / --download-ttlToken TTLs (e.g. 30m, 24h).
--checker-kind / --checker-config-jsonChecker kind and config (for component-type checker).
--datasvc-endpointDatasvc/KV gRPC endpoint override.

The hyphenated aliases edge-package-download, edge-package-token, and edge-package-revoke are equivalent to the corresponding edge package subcommands and are kept for backward compatibility.

nats-bootstrap​

Bootstraps NATS for a deployment: generates the operator, accounts, and creds files used by ServiceRadar's messaging layer.

srctl nats-bootstrap --token "<platform-bootstrap-token>"
srctl nats-bootstrap --local # offline, no core API
srctl nats-bootstrap --verify --config /etc/nats/nats.conf
FlagDescription
-core-urlCore base URL.
-api-key / -bearer / -tokenAuthentication and platform bootstrap token.
-output-dirWhere to write NATS config files (default /etc/nats).
-operator-nameNATS operator name (default serviceradar).
-import-operator-seedImport an existing operator seed instead of generating one.
-localGenerate operator and accounts locally without the core API.
-jetstream / -jetstream-dirEnable JetStream and set its storage directory.
-tls-cert / -tls-key / -tls-ca / -no-tlsTLS settings for the NATS server.
-verify / -configVerify an existing NATS bootstrap against a nats.conf.
-outputOutput format: text or json.

nats-account-limits​

Re-issues the platform NATS account JWT with the JetStream quota of the loaded sizing profile (SERVICERADAR_NATS_MAX_FILE_STORE), so an install bootstrapped with the fixed default quota converges. The account key is unchanged, so existing credentials stay valid. It does nothing when the variable is unset or the account already carries the quota, and it reports a missing operator seed or account instead of failing, so it never blocks NATS from starting. The Docker Compose stack runs it as the one-shot nats-account-limits service.

srctl nats-account-limits --creds-dir /etc/serviceradar/creds
FlagDescription
-creds-dirDirectory holding operator.seed and the jwt/ account JWTs written by nats-bootstrap (default /etc/serviceradar/creds).
-accountAccount whose JetStream quota follows the profile (default platform).

admin nats​

Inspects and manages NATS state through the core API.

srctl admin nats status
srctl admin nats accounts
srctl admin nats generate-bootstrap-token
SubcommandPurpose
statusShow the current NATS bootstrap status.
accountsList NATS accounts.
generate-bootstrap-tokenGenerate a platform bootstrap token for nats-bootstrap.

These subcommands accept --core-url and --api-key/--bearer for authentication, and support --output json.

auth — device-code login​

Authenticates against a ServiceRadar instance with the device-code flow (RFC 8628) and stores the issued JWT in the shared JS CLI credential store. Existing Go administrative commands still require their explicit authentication flags; they do not automatically read this store.

On Unix, the token lives at $XDG_CONFIG_HOME/serviceradar/credentials.json when XDG_CONFIG_HOME is set, otherwise at ~/.config/serviceradar/credentials.json. The file has mode 0600; newly created credential directories have mode 0700. Writes refuse an existing group- or world-writable credential directory. On Windows, the path is %APPDATA%\serviceradar\credentials.json, falling back to serviceradar\credentials.json under the user home when APPDATA is unset; Unix permission guarantees do not apply.

# Log in (opens the verification URL in a browser)
srctl auth login --instance https://serviceradar.example.com

# Log in without opening a browser (copy the printed URL by hand)
srctl auth login --instance https://serviceradar.example.com --no-browser

# Show stored logins (tokens are never printed)
srctl auth status

# Remove a stored login
srctl auth logout --instance https://serviceradar.example.com
SubcommandPurpose
loginRun the device-code flow and store the JWT.
statusShow instance, user, and timestamps for stored logins.
logoutRemove a stored login.
bcrypt-genPrint a bcrypt hash of --password (used by the Helm secret generator).

--instance must be an absolute http(s) URL and is stored verbatim (minus trailing slashes), so the key matches the one the JS CLI writes.

login accepts --scope (default dashboard.publish) and --no-browser. status and logout accept an optional --instance filter; without it, logout removes the only stored login and refuses when several are stored.