Grafana CLI (grafanactl)
$ grafanactl Official Med Riskgrafanactl is Grafana Labs' official Apache-2.0 Go CLI for managing Grafana resources (dashboards, folders, alerts) as code. Modeled after kubectl, it supports -o json and YAML outputs, multi-context config inspection (grafanactl config view -o json), resources get/pull/push, and ships an official SKILL.md.
brew install grafana/tap/grafanactl Use grafanactl with -o json and resources pull/push for dashboard/resource-as-code workflows; pair with Grafana MCP (mcp-grafana) for ad-hoc PromQL/LogQL exploration.
At a Glance
- Command
- $ grafanactl
- FCRS-1.0 Score
- 87/100 (Good)
- Evidence Tier
- High Confidence
- CLI vs MCP
- Hybrid (CLI + MCP)
- Reviewed Date
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Kubernetes-style resources get/pull/push verbs with consistent -o json / --output json support and bundled SKILL.md (official_skill).
- Native
-o jsonacrossconfig viewandresourcescommands - Ships
SKILL.mdingrafana/grafanactl(official_skill)
Context isolation and GitOps pull/diff workflow reduce accidental dashboard overwrites, though a global --dry-run flag is still evolving.
- Context-isolated
~/.config/grafanactl/config.yamland GitOpspullworkflow
Single Go binary installable via Homebrew tap (grafana/tap/grafanactl), go install, or GitHub releases across all three OSes.
- Available via
brew,go install, and cross-platform binaries
Cleanly unifies Grafana resource-as-code workflows (pull/push/edit/get) across folders and dashboards.
- Unified
resourcesabstraction for Grafana observability-as-code
Official grafana/grafanactl repository actively developed by Grafana Labs under Apache-2.0.
- Official
grafana/grafanactlrepo (Apache-2.0)
Clean GitHub Pages docs at grafana.github.io/grafanactl/ alongside SKILL.md and --help.
- Official docs site and
SKILL.md
Security, Auth & Guardrails
Stores Grafana server contexts and service-account tokens in ~/.config/grafanactl/config.yaml (inspectable via grafanactl config view).
CLI is free (Apache-2.0); connects to self-hosted Grafana or Grafana Cloud workspaces.
# grafanactl Agent Rules - Always run `grafanactl config view -o json` first to confirm the active Grafana context. - Prefer `grafanactl resources pull` and git diff review before running `grafanactl resources push`. - Require user confirmation before deleting or overwriting production dashboards.
Agent-Ready Command Recipes
Safe Read-Only Queries
grafanactl config view -o json
Prints configured Grafana contexts and active target URLs as JSON.
grafanactl resources get dashboards -o json
Lists dashboard resources from the active Grafana context in structured JSON.
Controlled Writes & Previews
grafanactl resources pull dashboards -p ./resources -o json
Exports dashboards to ./resources as local JSON files without modifying remote Grafana state.
Strengths for Agents
- + Consistent
-o jsonoutput and familiarkubectl-style resource verbs (get,pull,push). - + Ships official
SKILL.mdfor AI agent observability-as-code workflows. - + Fast Go binary installable via Homebrew tap,
go install, or releases.
Caveats & Pitfalls
- ! Designed for Grafana resource management rather than querying live Prometheus/Loki metrics.
- ! Relatively young tool compared to legacy Grafana APIs, with subcommands still evolving.
Official References
Tested Agent Hosts
Follow Ecosystem Links
Related CLIs in Workspace & SaaS
View category hub →Official Paddle Billing CLI for subscriptions, products, prices, and raw API requests with `--environment` and JSON output.
Official Resend CLI that auto-switches to JSON in non-TTY pipes for email, domain, and webhook workflows.
Official DatoCMS CLI for schema inspection, environment forks, and migrations with `--environment`, `--profile`, and `--json`.
Official Windmill CLI (`wmill`) with `--json`, `sync push --dry-run`, and `job logs` inspection.
Official Datadog Labs CLI companion across 33+ Datadog products with `--output json`, `--no-envelope`, and automatic AI agent detection.
Official Lark/Feishu CLI built for humans and AI agents with 200+ commands, `--json` envelopes, and 20+ built-in Agent Skills.