Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/grafana-cloud/ai-tools/gcx/guides/explore-modify-resources.md, or by sending Accept: text/markdown to https://grafana.com/docs/grafana-cloud/ai-tools/gcx/guides/explore-modify-resources/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at https://grafana.com/llms-full.txt.
Explore and modify resources with gcx
The Grafana CLI allows you to interact with Grafana resources directly from your terminal. You can browse, inspect, update, and delete resources without using the Grafana UI.
Use this approach if you’re an advanced user and want to manage resources more efficiently, or to integrate Grafana operations into automated workflows.
Find and delete dashboards using incorrect data sources
To identify and remove production dashboards relying on non-production data sources, use the command below to list dashboard UIDs along with the data source UIDs used in their panels:
gcx resources get dashboards --context prod | jq '.items | map({ uid: .metadata.name, datasources: .spec.panels | map(.datasource.uid) })'
[
{
"uid": "important-production-dashboard",
"datasources": [
"mimir-prod"
]
},
{
"uid": "test-dashboard-from-dev",
"datasources": [
"mimir-dev"
]
},
{
"uid": "test-dashboard-from-stg",
"datasources": [
"mimir-stg"
]
}
]Next, identify the dashboards that are using unexpected data sources, and delete them:
gcx resources delete dashboards/test-dashboard-from-stg,test-dashboard-from-dev
✔ 2 resources deleted, 0 errorsEdit remote resources
You can edit resources directly from the default editor, without having to pull them first:
gcx resources edit dashboard/edit-me-pleaseThis command opens the default editor as configured by the EDITOR environment variable, or fall back to ‘vi’ for Linux or ’notepad’ for Windows.
After the editor process terminates, the resource is updated in the Grafana instance targeted by the current context. Note that edition will be cancelled if no changes are written to the file or if the file after edition is empty.
Was this page helpful?
Related resources from Grafana Labs


