dashboard raw-to-prompt
What this page covers
Convert ordinary dashboard JSON or raw/ lane files into Grafana UI prompt JSON with __inputs.
When to open this page
- Use this when someone gives you a normal Grafana dashboard export, legacy raw JSON, or a raw/ lane file and you need a prompt-safe file for the Grafana UI Upload JSON flow.
Who this page is for
Best for SREs, Grafana operators, and responders working with dashboard inventory, migration, inspection, or screenshots.
Purpose
Convert ordinary dashboard JSON or raw/ lane files into Grafana UI prompt JSON with __inputs.
When to use
Use this when someone gives you a normal Grafana dashboard export, legacy raw JSON, or a raw/ lane file and you need a prompt-safe file for the Grafana UI Upload JSON flow.
Key flags
--input-file: repeat this for one or more dashboard JSON files.--input-dir: convert a directory tree. Forraw/or export roots, the default output is a siblingprompt/lane.--output-file: write one explicit output file. Only valid with one--input-file.--output-dir: write converted files under one output tree.--overwrite: replace existing prompt files.--datasource-map: optional JSON or YAML map for repairing datasource references.--resolution: chooseinfer-family,exact, orstrict.--profile,--url,--token,--basic-user,--basic-password,--org-id: optional live datasource lookup inputs used to augment datasource resolution.--dry-run: show what would be converted without writing files.--progress,--verbose: show progress lines or detailed per-file results.--output-format: render the final summary astext,table,json, oryaml.--log-file,--log-format: write per-item success/fail events to a text log or NDJSON log.--color: colorize summary output withauto,always, ornever.
Workflow notes
- Single-file mode defaults to a sibling
*.prompt.jsonoutput. - Repeated
--input-fileflags also default to sibling*.prompt.jsonoutputs beside each source file. - Plain directory input requires
--output-dirso generated prompt files do not mix into arbitrary source trees. raw/or combined export roots default to a sibling/generatedprompt/lane and also writeindex.jsonplusexport-metadata.json.prompt/artifacts are for the Grafana UIUpload JSONflow. They are not valid input forgrafana-util dashboard import, which still expectsraw/orprovisioning/.- If you provide
--profileor other live auth flags, the command queries the target Grafana datasource inventory and prefers those live matches over staged raw inventory.
Datasource resolution
infer-familyis the default practical mode. It can repair unambiguous families such as Prometheus, Loki, or Flux/Influx from query shape.exactrequires an exact datasource match from embedded data, raw inventory, or--datasource-map.exactcan also succeed through optional live datasource lookup when you provide--profileor direct live auth flags.strictfails as soon as a datasource cannot be resolved exactly.- When a dashboard uses multiple distinguishable datasource references, the command keeps multiple prompt slots instead of merging only by family.
- Ambiguous families such as generic SQL/search/tracing still need better source data or an explicit
--datasource-map.
Placeholder model
$datasourceis a dashboard variable reference. It means the dashboard or panel is selecting a datasource through a Grafana variable nameddatasource.${DS_PROMETHEUS}or${DS_*}is an external-import input placeholder. It means Grafana should ask for a datasource duringUpload JSONand then inject the selected value.- These are related but not identical. A generated prompt file can legitimately contain both:
${DS_*}in__inputsand some typed datasource references$datasourcein panel-level datasource fields that intentionally keep the dashboard-variable flowraw-to-prompttries to preserve that distinction instead of flattening everything into one placeholder style.- If a dashboard historically used Grafana datasource variables, the migrated prompt may still contain
$datasourcealongside__inputs.
Examples
# Purpose: Convert ordinary dashboard JSON or `raw/` lane files into Grafana UI prompt JSON with `__inputs`.
grafana-util dashboard raw-to-prompt --input-file ./dashboards/raw/cpu-main.json
# Purpose: Convert ordinary dashboard JSON or `raw/` lane files into Grafana UI prompt JSON with `__inputs`.
grafana-util dashboard raw-to-prompt --input-file ./legacy/cpu.json --input-file ./legacy/logs.json --progress
# Purpose: Convert ordinary dashboard JSON or `raw/` lane files into Grafana UI prompt JSON with `__inputs`.
grafana-util dashboard raw-to-prompt --input-dir ./dashboards/raw --overwrite
# Purpose: Convert ordinary dashboard JSON or `raw/` lane files into Grafana UI prompt JSON with `__inputs`.
grafana-util dashboard raw-to-prompt --input-dir ./legacy-json --output-dir ./converted/prompt --output-format table
# Purpose: Convert ordinary dashboard JSON or `raw/` lane files into Grafana UI prompt JSON with `__inputs`.
grafana-util dashboard raw-to-prompt --input-file ./legacy/cpu.json --datasource-map ./datasource-map.yaml --resolution exact --log-file ./raw-to-prompt.log --log-format json
# Purpose: Convert ordinary dashboard JSON or `raw/` lane files into Grafana UI prompt JSON with `__inputs`.
grafana-util dashboard raw-to-prompt --input-file ./legacy/cpu.json --profile prod --org-id 2 --resolution exact