Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Grafana Dashboard Import

Grafatui imports supported Grafana dashboard JSON files and renders supported panels in the terminal.

FormatStatusRequirements
Classic JSON✅ SupportedNon-resource object with fields such as title, panels, and templating
V2 Resource JSON🔶 PartialJSON only, exact apiVersion: dashboard.grafana.app/v2, and spec.layout.kind: GridLayout
V1 Resource JSON❌ UnsupportedThe dashboard.grafana.app/v1 resource envelope is not accepted
Resource YAML❌ Unsupported--grafana-json accepts JSON only

The supported V2 subset maps inline Panel elements, Prometheus PanelQuery queries, top-level variables, timeSettings.autoRefresh, supported field configuration, and fixed-grid positions to the same Grafatui behavior as Classic JSON.

V2 layouts other than GridLayout (including Rows, Tabs, and Auto-grid) are fatal import errors. Repeated grid items are also rejected rather than silently changing the dashboard.

Export From Grafana

  1. Open the dashboard in Grafana.
  2. In the toolbar, open Export and select Export as code.
  3. Expand Advanced options.
  4. Set Model to Classic.
  5. Download the file, or copy the JSON into a local .json file.
  6. Run Grafatui with --grafana-json.
grafatui --prometheus-url http://localhost:9090 --grafana-json ./node-exporter.json

Grafana 13 defaults to the V2 Resource model. Its fixed-grid JSON resources can be imported directly. For advanced V2 dashboards, use this Classic export path as the fallback. Grafana documents the available models and export controls in Export a dashboard as code.

Supported Panel Types

Grafatui currently supports:

  • graph
  • timeseries
  • stat
  • gauge
  • bargauge
  • table
  • heatmap

Row panels are traversed so nested panels can be imported, but row headers and collapsed row behavior are not rendered.

Variables

Grafatui reads dashboard variables from templating.list and expands $var and ${var} in PromQL expressions.

Defaults come from the dashboard JSON. Override them from the CLI:

grafatui --grafana-json ./dash.json --var job=node --var instance=server-01

Prometheus query variables such as label_values(up, instance) and query_result(...) are resolved before panel queries run.

Import Diagnostics

Grafatui prints import warnings before starting the TUI when a dashboard uses important Grafana features that are skipped or ignored. Diagnostics include unsupported panel types, value mappings, reduce options, unresolved variables, unsupported V2 datasources, and unsupported variable modifiers such as ${var:regex}. V2 diagnostics retain their spec.* source paths.

Run a non-interactive check with:

grafatui --validate --grafana-json ./dash.json

Warnings do not make validation fail. A dashboard that can be parsed and imported exits successfully even if diagnostics are printed.

Use --strict to make warnings fail validation, or --format json to emit a machine-readable summary. Fatal V2 layout and repeat errors fail validation in all modes; --strict additionally fails when import diagnostics are present:

grafatui --validate --strict --grafana-json ./dash.json
grafatui --validate --format json --grafana-json ./dash.json

Hidden Targets

Grafatui honors targets[].hide by skipping hidden targets during import. Panels with a mix of hidden and visible targets render only the visible target queries.

Query Modes

Grafatui honors targets[].instant from Grafana dashboard JSON. Targets marked as instant use the Prometheus instant query endpoint, while range targets use query_range.

If a target does not specify instant, Gauge, Bar Gauge, and Table panels default to instant queries. Graph, Timeseries, Stat, and Heatmap panels default to range queries.

Field Configuration

Grafatui applies selected fieldConfig.defaults values where they map cleanly to terminal rendering:

  • min and max set explicit Graph y-axis bounds and Gauge limits.
  • thresholds render graph threshold lines and drive dynamic coloring for Stat, Gauge, and Bar Gauge panels.
  • unit, decimals, and noValue affect supported panel values, axes, legends, and exports.
  • custom.axisGridShow controls per-panel graph guide lines.

Built-In PromQL Variables

Grafatui expands the following Grafana-style variables:

  • $__interval
  • $__interval_ms
  • $__range
  • $__range_s
  • $__range_ms
  • $__rate_interval
  • $__rate_interval_ms

Compatibility Details

See the Grafana compatibility matrix for field-by-field support details.