Agents
Structured output, safety flags, and non-interactive Grafana workflows for coding agents.
Grafana CLI exposes global controls intended for scripts and coding agents.
The output contract
- Use
-o jsonwhen the result will be parsed. - Use
--quietto suppress informational output where a command supports it. - Prefer stable UIDs for dashboards, folders, datasources, and alerting resources.
- Inspect first, then mutate with an explicit resource ID or UID.
Safety flags
| Flag | Effect |
|---|---|
--read-only | Blocks commands annotated as mutating, including create, update, delete, restore, switch, and reload operations |
--no-input | Disables interactive prompts; commands fail instead of waiting for input |
--quiet | Suppresses informational output |
--verbose | Enables verbose HTTP logging for diagnostics |
# Safe, non-interactive reads for an agent
grafana dashboard list --read-only --no-input --quiet -o json
grafana alert rule list --read-only --no-input --quiet -o jsonGRAFANA_NO_INPUT=1, GRAFANA_QUIET=1, and GRAFANA_VERBOSE=1 provide the
same non-interactive, quiet, and verbose controls through the environment.
The once-a-day "new version" notice is printed on stderr only when stderr is a
terminal, so it never appears in agent or CI output. GRAFANA_NO_UPDATE_NOTIFIER=1
(or NO_UPDATE_NOTIFIER=1) turns it off everywhere. To update the CLI itself
without a prompt, run grafana update --yes.
--no-input does not approve destructive actions. A delete or reset command
still needs its real --confirm flag; --read-only blocks the operation even
when confirmation is present.
Connection via environment
Agents do not need to run the interactive login flow:
export GRAFANA_URL=https://grafana.example.com
export GRAFANA_TOKEN=glsa_xxxxxxxxxxxxxxxxxxxx
grafana user current --read-only --no-input -o jsonAgent references
docs/llms.txt: the full command manualllms.txtindexes these docs, andllms-full.txtcontains all of them in one file- Claude Code skill