/grafana:provisioningfrom grafana
Guides selection and usage of Grafana provisioning methods: file YAML, HTTP API, gcx CLI, Terraform provider, Foundation SDK, and Git Sync. Helps choose the right tool for datasources, dashboards, and alerting as code.
Ships in grafana. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Make Grafana resources reproducible. Pick the right tool for each resource type and team workflow, then keep the runtime configuration in sync with version control. Wrong tool choices don't cause errors immediately — they show up months later as drift, brittle CI, or notification policies overwritten by a partial config push.
${CLAUDE_SKILL_DIR}/references/file-provisioning.md] Directory layout, env var
interpolation, full datasource / dashboard / plugin / alerting YAML schemas, reload behavior, UI edit semantics${CLAUDE_SKILL_DIR}/references/http-api.md] New /apis/ Kubernetes-style surface vs. legacy
/api/, dashboard / folder / datasource CRUD, alerting provisioning endpoints, annotation API, pagination,
authentication${CLAUDE_SKILL_DIR}/references/terraform.md] Provider setup, full resource catalog, dashboards /
datasources / alerting examples, provenance and UI-edit toggle, GitHub Actions workflow, import workflow${CLAUDE_SKILL_DIR}/references/gcx.md] Grafana CLI install, contexts, resource pull/push/serve, telemetry
queries, agentic features and skills, CI integration, migration from grafanactl${CLAUDE_SKILL_DIR}/references/observability-as-code.md] Tool comparison, decision
matrix, how to compose tools, migration paths (Grizzly → gcx, legacy API → new API, file → Terraform)Pick the primary tool based on resource type and team workflow. The references above contain a full decision matrix — quick selection rules:
gcx (Grafana ≥ v12)gcxgcxgrafanactl until upgrading; the binary keeps
working through the 2026-06-01 archive dateCompose tools where natural: Foundation SDK generates, gcx pushes; Terraform owns alerting + data sources, file
provisioning ships fixed dashboards.
gcx is the current Grafana CLI. Requires Grafana ≥ v12. Public preview as of 2026. Inherits grafanactl's
design and adds telemetry queries, agentic-driver auto-detection, and broader Grafana Cloud product coverage.grafanactl is superseded by gcx. GitHub repo archives 2026-06-01. Migration is a binary rename plus one
command rename (grafanactl resources serve → gcx dev serve). Don't adopt for new work unless on Grafana < v12.grafanactl,
now gcx. Don't adopt for new work./api/dashboards/db is legacy; use /apis/dashboard.grafana.app/v1/... where the new API supports the case
(especially dashboards v2 / dynamic dashboards).YAML files in provisioning/ directories read by Grafana at startup. Not available in Grafana Cloud.
provisioning/
├── datasources/ # *.yaml — data source configs
├── dashboards/ # *.yaml — dashboard provider configs (NOT dashboards themselves)
├── plugins/ # *.yaml — plugin app configs
└── alerting/ # *.yaml or *.json — alert resources
Dashboard JSON files live elsewhere (e.g., /var/lib/grafana/dashboards/) and the dashboard provider YAML points to
them.
All provisioning YAML supports $VAR and ${VAR} for values (not keys, not dashboard JSON). Order: ${VAR} first,
then $VAR. Escape literal $ as $$. Prefer $VAR when the substituted value contains $.
apiVersion: 1
prune: true # auto-delete provisioned datasources removed from this file
datasources:
- name: Prometheus # required, unique per org
type: prometheus # required
access: proxy # proxy = Server, direct = Browser
uid: prom_main
url: http://prometheus:9090
isDefault: true
jsonData:
prometheusType: Mimir
manageAlerts: true
secureJsonData:
httpHeaderValue1: ${TENANT_TOKEN}
editable: false
Secrets go in secureJsonData (encrypted at rest). For multi-instance Grafana with shared DB, set version and bump it
on each change.
Provider YAML configures discovery; dashboard JSON files contain the dashboards:
apiVersion: 1
providers:
- name: 'team-platform'
folder: '' # '' = root
type: file
disableDeletion: false
updateIntervalSeconds: 30 # poll if > 10, watch filesystem if ≤ 10
allowUiUpdates: false # let UI edits persist until next reprovision
options:
path: /var/lib/grafana/dashboards
foldersFromFilesStructure: true
foldersFromFilesStructure: true maps subdirectory names to Grafana folders. Nested folders not supported.
Dashboard JSON must use the Kubernetes-style format for dashboards v2 / dynamic dashboards
(apiVersion: dashboard.grafana.app/v1).
provisioning/alerting/*.yaml can contain any combination of:
groups — alert rule groups (with name, folder, interval, rules[])contactPoints — contact points with receivers[]policies — the notification policy tree (entire tree is one resource — replaces existing)templates — notification template groupsmuteTimes — mute time intervalsPlus deleteRules, deleteContactPoints, deleteTemplates, deleteMuteTimes, resetPolicies.
Variable interpolation does not apply in: alert rule annotations, relativeTimeRange, query data.model, mute
timing names/intervals, template names/bodies. Escape $variable as $$variable where not wanted.
Provisioning runs at startup. Reload at runtime via the Admin API (POST /api/admin/provisioning/{type}/reload) —
requires admin permissions. Dashboard files have their own poll/watch loop independent of provisioning reload.
Two surfaces:
/apis/<group>.grafana.app/<version>/... — Kubernetes-style resources. Covers dashboards, folders, library
panels, playlists; expanding over time. Built on these are gcx, Foundation SDK, Git Sync./api/... — data sources, annotations, admin, alerting provisioning. Won't get new functionality but
remains functional.Service account tokens (recommended) via Authorization: Bearer <token>. API keys still work but are deprecated.
POST /apis/dashboard.grafana.app/v1/namespaces/<ns>/dashboards
PUT /apis/dashboard.grafana.app/v1/namespaces/<ns>/dashboards/<uid>
GET /apis/dashboard.grafana.app/v1/namespaces/<ns>/dashboards/<uid>
GET /apis/dashboard.grafana.app/v1/namespaces/<ns>/dashboards?limit=100
DELETE /apis/dashboard.grafana.app/v1/namespaces/<ns>/dashboards/<uid>
Namespace is default for single-org Grafana, stack-<id> for Grafana Cloud. Use pagination's metadata.continue
token for list endpoints.
/api/v1/provisioning/{alert-rules,contact-points,policies,templates,mute-timings} — JSON CRUD.
Standard endpoints return JSON not compatible with file provisioning. For round-tripping via configuration files,
use /export endpoints which return YAML / JSON / Terraform format.
Resources created via the API can't be edited in the UI by default. Send X-Disable-Provenance: true to allow UI edits.
Legacy /api/datasources is the only data source surface. List defaults to 5000 max (no pagination). Always put secrets
in secureJsonData.
The Grafana Terraform provider has the broadest resource coverage of any IaC tool.
terraform {
required_providers {
grafana = {
source = "grafana/grafana"
version = ">= 2.9.0"
}
}
}
provider "grafana" {
url = "https://grafana.example.com"
auth = var.grafana_service_account_token
}
Authenticate with a service account token (Editor role minimum, plus fixed:alerting.provisioning.* for alerting
resources).
grafana_folder, grafana_dashboard, grafana_apps_dashboard_dashboard_v1|v2,
grafana_library_panelgrafana_data_source (use json_data_encoded / secure_json_data_encoded)grafana_rule_group, grafana_contact_point, grafana_message_template, grafana_notification_policy,
grafana_mute_timinggrafana_user, grafana_team, grafana_service_account, grafana_role,
grafana_role_assignmentgrafana_cloud_stack and supporting Cloud resourcesfor_eachresource "grafana_dashboard" "platform_dashboards" {
for_each = fileset("${path.module}/dashboards/platform", "*.json")
folder = grafana_folder.platform.id
config_json = file("${path.module}/dashboards/platform/${each.key}")
}
Terraform-managed resources are read-only in the UI by default. Set disable_provenance = true on a resource to allow
UI edits. The next terraform apply overwrites UI changes — use sparingly.
Never commit terraform.tfstate to Git. Use a remote backend (S3+DynamoDB, Terraform Cloud, GCS, Azure Blob). Typical
CI: terraform fmt -check, plan on PRs (post plan as a comment), apply -auto-approve on main.
CLI for the new Kubernetes-style APIs plus telemetry queries. Resource pull/push/serve/edit between environments, PromQL/LogQL/trace queries, agentic-tool integration. Requires Grafana ≥ v12.
gcx config set contexts.production.grafana.server https://prod.grafana.example
gcx config set contexts.production.grafana.org-id 1
gcx config set contexts.production.grafana.token <token>
gcx config use-context production
gcx config check
Self-managed uses org-id; Grafana Cloud uses stack-id. Pick one.
gcx config use-context development
gcx resources pull --path ./resources/ -o yaml
gcx config use-context production
gcx resources push -p ./resources/
gcx resources get dashboards -o json | jq '.items | map({
uid: .metadata.name,
datasources: .spec.panels | map(.datasource.uid)
})'
gcx resources delete dashboards/test-from-stg,test-from-dev
gcx dev serve --script 'go run scripts/generate-dashboard.go' --watch ./scripts
go run scripts/generate-dashboard.go --generate-resource-manifests --output ./resources
gcx resources push -p ./resources/
gcx is designed for AI coding agents. Auto-detects drivers like Claude Code and Cursor, emits structured JSON/YAML
output with stable field names, exposes a machine-readable command catalog, and bundles portable skills
(gcx skills install --all) for alert investigation, SLO management, and observability setup.
When deciding how to provision a new resource:
gcx for volatile dashboards, Terraform / file for stable infra)gcx over grafanactl for new work (Grafana ≥ v12); grafanactl repo archives 2026-06-01When writing provisioning files:
secureJsonData (file) or secure_json_data_encoded (Terraform) — never in jsonDatauid / metadata.name on dashboards for stable URLseditable: false (datasources) or accept the default (alerting) for true source-of-truth behavior; enable UI
edits explicitly when neededWhen migrating between approaches:
/export endpoints or the UI Export feature to dump current state in the target tool's formatterraform import attaches existing resources without disruptionterraform plan (or gcx dry-run if available) — should be a no-op after a successful importWhen reviewing provisioning configuration:
url with embedded creds, jsonData containing passwords)updateIntervalSeconds is appropriate for the filesystem (raise above 10 if inotify events don't propagate)The alerting skill (sibling) governs what alerting resources should contain and how they behave at runtime (state lifecycle, routing, templates). This skill governs how to deliver those resources to Grafana.
The dashboards skill (sibling) governs panel composition and dashboard design. This skill governs how dashboards are written to disk, pushed to Grafana, and version-controlled.
The prometheus, logsql/metricsql language skills cover query expressions inside provisioned resources. This skill does not.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub xobotyi/cc-foundry --plugin grafana7 skills in this plugin
/alertingGrafana unified alerting: rule types, evaluation lifecycle, state transitions, notification policies, contact points, silences, mute timings, recording rules, and alert/notification templates. Invoke whenever task involves any interaction with Grafana alerting — creating or editing alert rules, configuring contact points and routing, templating annotations or notifications, debugging alert state, or reviewing alerting configuration./dashboardsGrafana dashboard authoring: JSON model (Classic and V2), panel types and selection, standard options, thresholds, value mappings, field overrides, transformations, variables (query/custom/interval/filter), repeating panels and rows, annotations, dashboard/panel/data links, and library panels. Invoke whenever task involves any interaction with Grafana dashboards — creating, editing, reviewing, debugging, or understanding dashboard configuration./datavizData visualization discipline for monitoring and observability dashboards: chart-type selection by data shape, encoding accuracy hierarchy (position > length > angle > area > color), pre-attentive attributes, Tufte data-ink, color theory (semantic conventions, Viridis, colorblind safety), dashboard layout and information hierarchy (F/Z-pattern, tiering), time-series conventions (baseline, interpolation, dual axes, stacking), observability frameworks (RED, USE, Four Golden Signals, SLO/SLI). Invoke whenever task involves any interaction with dashboard design quality — making a good dashboard, reviewing a visualization, picking a chart type, dashboard layout, color choices, panel arrangement, or critiquing existing observability dashboards./logsqlVictoriaLogs LogsQL query language: filters (word, phrase, prefix, regexp, range, IPv4 range, exact, stream, time), pipe operators (stats, sort, fields, format, extract, unpack_json, unpack_logfmt, math, limit, top, uniq), stats functions, log stream filtering with Prometheus-style label selectors, field extraction, and performance patterns. Invoke whenever task involves any interaction with LogsQL — writing, debugging, optimizing, or reviewing VictoriaLogs queries./metricsqlVictoriaMetrics MetricsQL query language as a PromQL superset: rollup extensions, behavioral differences from PromQL (rate/increase semantics, implicit conversions, auto-aligned subqueries), label manipulation, WITH templates, keep_metric_names modifier, multiple-or filters, and query API enhancements. Invoke whenever task involves any interaction with MetricsQL or VictoriaMetrics queries — writing, debugging, optimizing, migrating PromQL to VictoriaMetrics, or reviewing./promqlPromQL query writing: selectors, operators, vector matching, functions, aggregations, histograms, subqueries, recording rules, alerting rules, and query optimization. Invoke whenever task involves any interaction with PromQL — writing, debugging, optimizing, reviewing, or explaining Prometheus queries for dashboards, alerts, recording rules, or ad-hoc exploration.Other plugins' skills for the same job