|
1 | 1 | # OpenStatus CLI |
2 | 2 |
|
3 | | -OpenStatus CLI is a command line interface for OpenStatus. |
| 3 | +Manage status pages, monitors, and incidents from the terminal. |
4 | 4 |
|
5 | 5 | ## Installation |
6 | 6 |
|
| 7 | +### Homebrew |
| 8 | + |
7 | 9 | ```bash |
8 | 10 | brew install openstatusHQ/cli/openstatus --cask |
9 | 11 | ``` |
10 | 12 |
|
11 | | -#### Windows |
| 13 | +### macOS / Linux |
| 14 | + |
| 15 | +```bash |
| 16 | +curl -fsSL https://raw.githubusercontent.com/openstatusHQ/cli/refs/heads/main/install.sh | bash |
| 17 | +``` |
| 18 | + |
| 19 | +### Windows |
| 20 | + |
12 | 21 | ```powershell |
13 | 22 | iwr https://raw.githubusercontent.com/openstatusHQ/cli/refs/heads/main/install.ps1 | iex |
14 | 23 | ``` |
15 | 24 |
|
16 | | -#### macOS |
| 25 | +## Quick Start |
| 26 | + |
17 | 27 | ```bash |
18 | | -curl -fsSL https://raw.githubusercontent.com/openstatusHQ/cli/refs/heads/main/install.sh| bash |
| 28 | +# Authenticate with your API token |
| 29 | +openstatus login |
| 30 | + |
| 31 | +# List your monitors |
| 32 | +openstatus monitors list |
| 33 | + |
| 34 | +# Get detailed info on a monitor (live status + latency percentiles) |
| 35 | +openstatus monitors info 123 |
| 36 | + |
| 37 | +# Trigger an on-demand check |
| 38 | +openstatus monitors trigger 123 |
| 39 | + |
| 40 | +# Report an incident |
| 41 | +openstatus status-report create --title "API degradation" --status investigating --page-id 1 |
| 42 | + |
| 43 | +# Run synthetic tests from config |
| 44 | +openstatus run |
19 | 45 | ``` |
20 | 46 |
|
21 | | -#### Linux |
| 47 | +## Commands |
| 48 | + |
| 49 | +| Command | Alias | Description | |
| 50 | +|---------|-------|-------------| |
| 51 | +| `login` / `logout` | | Authenticate with the OpenStatus API | |
| 52 | +| `whoami` | `w` | Show current workspace info | |
| 53 | +| `monitors` | `m` | List, inspect, trigger, import, and apply monitors | |
| 54 | +| `status-report` | `sr` | Create and manage incident reports | |
| 55 | +| `maintenance` | `mt` | Schedule and manage maintenance windows | |
| 56 | +| `status-page` | `sp` | View status pages and components | |
| 57 | +| `notification` | `n` | View notification channels | |
| 58 | +| `run` | `r` | Run synthetic tests across global regions | |
| 59 | +| `terraform generate` | `tf gen` | Export workspace resources to Terraform HCL | |
| 60 | + |
| 61 | +### Global Flags |
| 62 | + |
| 63 | +| Flag | Description | |
| 64 | +|------|-------------| |
| 65 | +| `--json` | Machine-readable JSON output | |
| 66 | +| `--quiet`, `-q` | Suppress non-error output | |
| 67 | +| `--debug` | Print HTTP request details to stderr | |
| 68 | +| `--no-color` | Disable colored output | |
| 69 | +| `--access-token`, `-t` | Override API token | |
| 70 | + |
| 71 | +## Monitors as Code |
| 72 | + |
| 73 | +Define monitors declaratively in YAML and sync them with `apply`: |
| 74 | + |
22 | 75 | ```bash |
23 | | -curl -fsSL https://raw.githubusercontent.com/openstatusHQ/cli/refs/heads/main/install.sh | bash |
| 76 | +# Export existing monitors to openstatus.yaml + openstatus.lock |
| 77 | +openstatus monitors import |
| 78 | + |
| 79 | +# Preview changes |
| 80 | +openstatus monitors apply --dry-run |
| 81 | + |
| 82 | +# Apply changes |
| 83 | +openstatus monitors apply |
24 | 84 | ``` |
25 | 85 |
|
| 86 | +## Terraform Export |
| 87 | + |
| 88 | +Generate Terraform HCL for your entire workspace: |
| 89 | + |
| 90 | +```bash |
| 91 | +openstatus terraform generate --output-dir ./terraform |
| 92 | +``` |
| 93 | + |
| 94 | +This creates `provider.tf`, `monitors.tf`, `notifications.tf`, `status_pages.tf`, and `imports.tf` ready for `terraform plan`. |
| 95 | + |
| 96 | +## Authentication |
| 97 | + |
| 98 | +The CLI resolves your API token in this order: |
| 99 | + |
| 100 | +1. `--access-token` / `-t` flag |
| 101 | +2. `OPENSTATUS_API_TOKEN` environment variable |
| 102 | +3. Saved token at `~/.config/openstatus/token` (written by `openstatus login`) |
| 103 | + |
26 | 104 | ## Development |
27 | 105 |
|
28 | | -### Generate Documentation |
| 106 | +### Run Tests |
29 | 107 |
|
30 | | -Run this command to generate the documentation: |
| 108 | +```bash |
| 109 | +go test -race ./... |
| 110 | +``` |
| 111 | + |
| 112 | +### Generate Documentation |
31 | 113 |
|
32 | 114 | ```bash |
33 | | - go run cmd/docs/docs.go |
34 | | - cd docs |
35 | | - pandoc -s -t man openstatus-docs.md -o openstatus.1 |
36 | | - ``` |
| 115 | +go run cmd/docs/docs.go |
| 116 | +cd docs |
| 117 | +pandoc -s -t man openstatus-docs.md -o openstatus.1 |
| 118 | +``` |
0 commit comments