observer CLI applies and exports your configuration through the
public API. Your configuration lives in your repository, is reviewed in
pull requests, and is applied through a workflow you control.
The CLI is open source at github.com/useobserver/cli.
Install
Binary
The install script downloads the binary for your platform and puts it on PATH:~/.local/bin,
/opt/homebrew/bin, or /usr/local/bin that is on your PATH and
writable, without sudo, and falls back to ~/.local/bin. To choose
the directory, set OBSERVER_INSTALL_DIR:
sh side of the pipe, because the install
script reads it, not curl.
Binaries for Linux and macOS (x64 and arm64) and Windows (x64) are published
on the releases page,
each with a SHA-256 checksum.
GitHub Action
Run the CLI in CI without installing a binary:@v1 tracks the newest 1.x release; pin a full tag such as @cli-v1.1.0
to freeze it.
The action takes three inputs:
Configure
Commands
0 success, 1 validation failure or error, 2 usage error.
Top-level keys that config does not manage, such as incidents or
customers, are ignored. From CLI 1.1.0, apply prints them under a
Warnings: heading after the plan or apply summary:
POST /config/apply returns a diff
entry for every object the document names; pass verbose=false to
leave out the unchanged entries (the summary still counts them).
The MCP server sends verbose=false by default.
Metric fields
Intervals are minutes, not seconds. A value such as
300 fails
validation, and the error suggests the value in minutes (5).
thresholds is required, with all four fields, when a document
creates a metric. Manual, heartbeat and inbound alert metrics are the
exception: their status does not come from thresholds you write. On an
existing metric, leaving thresholds out keeps the current
thresholds; include it to change them.
The unit of the value a metric reports follows from its source_type
(milliseconds for HTTP, TCP and DNS, days for TLS certificates, and so
on; see Probe types). Set thresholds in
that unit. To see what a source returns before you write thresholds,
test it once.
Agents
Metrics other than heartbeat, manual and inbound alert metrics run on an Observer Agent. Name the agent in the metric’sagent field:
agent is the agent’s name as shown on the Agents page or by
GET /agents. Apply checks it against the
agents in your organization:
- A name that matches no agent fails validation, and so does a name
that two agents share. Nothing is applied, and the error lists the
agent names that exist. Create the agent first (in the console or
with
POST /agents), or fix the name. - A metric whose source runs on an agent but names none is accepted with a warning. It gets no data until an agent is assigned.
- A heartbeat or inbound alert metric must not name an agent.
Reference existing metrics
An SLO’smetric, and the metrics of a page or a service, can name
a metric the document defines or a metric that already exists in your
organization. An existing metric is named by its config key or, for a
metric made in the console, by the key observer export --all gives
it: its title in lowercase with dashes, then the first six characters
of its id (for example checkout-latency-3f9a1c).
referenced in the result (and
counted in the summary). Apply never creates, changes, or prunes them,
so a document can build pages, services and SLOs on metrics it does not
own. A reference that matches no metric fails validation.
Services
A service’smetrics sets its member metrics. When present it is the
exact set: metrics left out are removed from the service, and []
removes them all. When omitted, the members stay as they are. A
service’s metrics are its members plus the metrics its SLOs measure.
GET /services returns each service’s
metrics, with via: member or via: slo.
Status pages
A page’smetrics list controls which metrics the page shows, their
group, and their order. Settings edited per metric in the console,
such as the public label and whether the uptime bar is shown, are kept
when you apply. The plan lists, for each page, the metrics added,
removed, and regrouped or reordered.
A page entry can also set the page’s settings. Settings you leave out
keep their current value; they are never reset.
The plan names the settings that change on an existing page. To change
one setting without a document, call
PATCH /pages/{id}. Custom CSS, custom
domains, and access modes that carry credentials stay in the console.
To find the address of a page after applying, read public_url from
GET /pages. It is the custom domain when one
is active, and the page’s subdomain address otherwise.
Delete one object
--prune deletes every config-managed object that the document no
longer names. To delete a single metric, service, SLO, or status page
instead, call its DELETE endpoint with the object’s id or its config
key:
write:config. The same rules as prune apply:
- Only config-managed objects can be deleted this way. An object made
in the console returns
409 not_config_managed. - If other objects depend on it (SLOs on a metric or service, pages
showing a metric, active subscribers of a page), the request returns
409 in_usewith the dependents inreferenced_by. Repeat with?cascade=trueto delete or detach them too. - A page with a custom domain returns
409 custom_domain_attached. Remove the domain in the console first.
Heartbeat metrics
A heartbeat check is declared like any other metric, withsource_type: heartbeat:
- Do not set
agent. Observer evaluates heartbeats itself, and a heartbeat metric that names an agent fails validation. thresholdsare ignored. They are derived fromperiod_secondsandgrace_seconds, andobserver exportomits them.- The ping URL is never part of the document or the export. Copy it
from the console, or read it from the
heartbeat API with the
same
write:configkey you apply with. - An existing metric cannot switch into or out of
heartbeat. Delete it and create it again under a new key.
What apply changesApply upserts the objects named in your document and marks them
config-managed. Objects you do not name are left alone. Pass
--prune
only when you want objects removed from the document deleted from Observer.Prune only deletes config-managed objects. Objects created in the
console have no config key, so neither apply nor prune touches them
unless your document names them (for example after
observer export --all), in which case apply adopts them as
config-managed.observer export writes JSON by default; pass --format yaml for
YAML. It exports config-managed objects only; add --all to include
objects created in the console.
