CLI Reference
import { Tabs, TabItem } from ‘@astrojs/starlight/components’;
The 9n9s Command-Line Interface (9n9s-cli) allows you to interact with the 9n9s platform from your terminal.
Global Options
Section titled “Global Options”| Option | Description |
|---|---|
--api-key <key> | Specify the API key directly. Overrides stored credentials. |
--project <id> | Specify the project ID to scope a command to. |
--help | Show help for a command. |
--version | Show the CLI version. |
Commands
Section titled “Commands”Authenticate the CLI with your 9n9s account.
9n9s-cli loginPrompts for an API Key, which is then stored locally for subsequent commands.
monitors
Section titled “monitors”Manage monitors.
9n9s-cli monitors list [options]Options:
--project <id>: Filter by project ID.
heartbeat
Section titled “heartbeat”Manage Heartbeat Monitors.
9n9s-cli heartbeat create [options]Options:
--name <string>(required)--schedule <string>(required)--grace <duration>(required)--project <id>(required)--tags <list>--timezone <tz>
`: Send a pulse with the given exit code.
- `--message `: Send a message payload with the pulse.
- `--payload `: Send a JSON payload with the pulse.
When a <command> is provided after --, the CLI will send a /start pulse, execute the command, and then send a final pulse with the command’s exit code.
uptime
Section titled “uptime”
Manage Uptime Monitors.
Terminal window 9n9s-cli uptime create [options]
Options:
--name <string> (required)
--protocol <HTTP/TCP> (required)
--target <url/host:port> (required)
--frequency <duration> (required)
--project <id> (required)
--tags <list>
--assertions <json_string>: A JSON string defining the assertions.
Terminal window 9n9s-cli uptime update <monitor_id> [options]
Accepts the same options as create.
Manage Configuration as Code.
Terminal window 9n9s-cli cac diff --file <path>
Compares the local definition file with the remote state and shows a diff of the planned changes.
Terminal window 9n9s-cli cac apply --file <path>
Applies the definitions from the local file to the remote state, creating, updating, and deleting resources as needed.