Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Grafana CLI

$ gcx Official Med Risk
Grafana Labs · Workspace & SaaS · Apache-2.0 · macos / linux / windows

Grafana CLI (gcx) is Grafana Labs' official CLI for Grafana, Grafana Enterprise, and Grafana Cloud—managing dashboards, SLOs, IRM, contexts, and Grafana Assistant. Built with -o json, --agent mode (forces JSON and disables color), --jq filtering, --limit, and keychain-backed credential storage.

FCRS-1.0 Score
91 /100
Excellent
Medium Confidence
Zero-Friction Install
brew install gcx
CLI vs MCP Decision Hybrid (CLI + MCP)

gcx excels at local GitOps dashboard pulls (resources pull), --agent/--jq scripting, and CI tokens; Grafana MCP fits interactive natural-language query sessions inside chat hosts.

Agent-Readiness Checklist

✓ JSON Output
✓ Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
✓ NO_COLOR Clean
✓ Self-Describing
✓ Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 23 / 25

Features -o json, dedicated --agent mode (JSON + no-color), built-in --jq, --limit, and official agent skills support.

  • --agent forces JSON output and disables terminal ANSI colors
  • Built-in --jq and --limit bound and filter large payloads
Trust & Safety 22 / 25

Defaults to OS keychain credential storage with path-bound references, supports GCX_KEYCHAIN=off and GRAFANA_TOKEN for CI isolation.

  • Keychain-backed token storage prevents plaintext leakage by default
  • --context isolates staging vs production Grafana instances
Setup & Portability 14 / 15

Single Go binary distributed via Homebrew (brew install gcx), go install, and GitHub Releases for macOS, Linux, and Windows.

  • Available via brew install gcx and native releases
Utility & Efficiency 13 / 15

Unifies Grafana OSS, Enterprise, and Cloud workflows (dashboards, SLOs, IRM, Assistant) in one CLI.

  • Covers resources, slo, irm, assistant, and context
Maintenance & Lineage 10 / 10

Official Grafana Labs CLI (grafana/gcx) under Apache-2.0 license.

  • First-party Grafana Labs open-source project
Docs & Verifiability 9 / 10

Thorough Grafana Cloud CLI docs covering keychain policies, flags, billing notes, and agent integrations.

  • Official docs at grafana.com/docs/grafana-cloud/send-data/gcx/

Security, Auth & Guardrails

Auth Modes
Env API Key OS Keychain Service Account Config File
Credential Storage

Stores tokens in OS keychain (macOS Keychain, Linux Secret Service, Windows Credential Manager) referenced by ~/.config/gcx/config.yaml (override with GCX_KEYCHAIN=off for CI), or reads GRAFANA_SERVER and GRAFANA_TOKEN env vars.

Side Effects
Read-Only Local Write Remote Write Destructive Billing Impact
Cost & Quotas

Apache-2.0 open-source CLI; works with free OSS Grafana or paid Grafana Cloud tiers (Assistant/k6/Synthetic usage may bill).

Copyable Guardrail for CLAUDE.md / AGENTS.md
# Grafana CLI (gcx) Agent Rules
- Always pass `-o json` (or `--agent`) and explicit `--context <name>` to prevent cross-environment mistakes.
- In containers or headless CI, set `GCX_KEYCHAIN=off` and supply `GRAFANA_SERVER` + `GRAFANA_TOKEN`.
- Require explicit approval before pushing dashboards, deleting SLOs, or invoking billable Assistant/Synthetic actions.

Agent-Ready Command Recipes

Safe Read-Only Queries

Pull dashboards as structured JSON in agent mode
gcx resources pull dashboards -o json --agent

Exports dashboard definitions in machine-readable JSON with ANSI color disabled.

List Grafana contexts with limit and jq filter
gcx context list -o json --limit 20 --jq '.[].name'

Lists configured Grafana CLI contexts and filters context names natively.

Controlled Writes & Previews

Validate context connectivity in CI
GCX_KEYCHAIN=off gcx context current -o json

Inspects the active Grafana server context without relying on a desktop OS keychain.

Strengths for Agents

  • + --agent, -o json, --jq, and --limit make gcx fast and token-efficient for agents.
  • + Secure OS keychain storage by default with clean GCX_KEYCHAIN=off fallback for headless CI.

Caveats & Pitfalls

  • ! Copying ~/.config/gcx/config.yaml across machines does not transfer keychain-bound tokens.
  • ! Some Grafana Cloud commands (Assistant, Synthetic Monitoring, k6) trigger usage-based cloud charges.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI