Skip to main content

ServiceRadar CLI

The serviceradar 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, and bootstrapping NATS.

Where the binary lives

The CLI ships as the serviceradar-cli package and installs the binary at /usr/local/bin/serviceradar-cli. 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.

Examples in this page use serviceradar as the command name; on a host where only the package binary is present, invoke it as serviceradar-cli.

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
serviceradar mypassword

# Hash a password read from stdin
echo mypassword | serviceradar

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

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.

serviceradar 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
serviceradar update-gateway -file /etc/serviceradar/gateway.json -type sysmon

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

# Enable all standard checkers
serviceradar 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.

serviceradar generate-tls -ip 192.168.1.10,10.0.0.5
serviceradar generate-tls --non-interactive # uses 127.0.0.1
serviceradar 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.

serviceradar 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.

serviceradar enroll -token "<onboarding-token>"
FlagDescription
-tokenEnrollment token.
-core-urlCore API base URL (only needed when the token does not embed one).
-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.

serviceradar edge package create --label "site-a-gateway" --component-type gateway
serviceradar edge package list
serviceradar edge package show --id <package-id>
serviceradar edge package download --id <package-id> --download-token <token>
serviceradar edge package revoke --id <package-id>
serviceradar edge package token --id <package-id> --download-token <token>
serviceradar 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.

serviceradar nats-bootstrap --token "<platform-bootstrap-token>"
serviceradar nats-bootstrap --local # offline, no core API
serviceradar 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.

admin nats

Inspects and manages NATS state through the core API.

serviceradar admin nats status
serviceradar admin nats accounts
serviceradar 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.