Grafana Dashboard Generator

Generates a Grafana dashboard JSON model from a form covering the dashboard title, one or more panels (title, graph/stat/table type, PromQL expr query, and grid position), and one templating variable, ready to paste into Grafana's dashboard JSON import. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-26

Overview

Introduction

Hand-writing a Grafana dashboard JSON model means tracking panel IDs, grid coordinates, and the exact nesting each panel type expects, which is tedious to get right from scratch.

This tool builds that JSON model from a form: add panels, pick a type, write the PromQL query, and the output is ready to paste into Grafana's dashboard import screen.

What Is Grafana Dashboard Generator?

A visual builder for a Grafana dashboard JSON model, the format Grafana itself exports when you save a dashboard and re-imports when you paste JSON into the import screen.

It covers the dashboard title, any number of panels (each with a title, panel type, PromQL query, and grid position), and a single query-based templating variable.

How Grafana Dashboard Generator Works

Each panel you add becomes one entry in the model's panels array, with an auto-incrementing id, its type mapped to Grafana's internal panel type name (graph becomes timeseries, stat stays stat, table stays table), and a single target carrying your PromQL expr.

Grid position (x, y, w, h) is taken from your input if provided, or auto-computed as a two-column layout otherwise. If you fill in a templating variable name and query, one entry is added to templating.list as a query-type variable; the whole model is then serialized with JSON.stringify at 2-space indentation.

When To Use Grafana Dashboard Generator

Use it when scaffolding a new Grafana dashboard for a service you're instrumenting, to quickly get a handful of PromQL panels onto one JSON model without clicking through Grafana's panel editor for each one.

It's also useful for generating a dashboard-as-code JSON file to check into version control alongside a Prometheus config, so the dashboard can be provisioned automatically.

Features

Advantages

  • Produces a valid dashboard JSON model structure (title, panels, templating) that Grafana's import screen accepts directly.
  • Auto-computes a non-overlapping two-column grid layout when you don't need precise custom positioning.
  • Maps friendly panel type names (graph/stat/table) to Grafana's internal type identifiers automatically.

Limitations

  • Only models one query target per panel; multi-query panels or panel-level thresholds/alerts need manual edits after import.
  • Only supports a single query-type templating variable, not interval, custom, or datasource variables.
  • Doesn't set a datasource UID on panels, so Grafana will prompt you to pick a datasource on first import unless you add one afterward.

Examples

A one-panel dashboard showing CPU usage

Input

title: "Node Overview", panel: title "CPU Usage" type stat query '100 - (avg(rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)'

Output

{
  "title": "Node Overview",
  "schemaVersion": 39,
  "panels": [
    {
      "id": 1,
      "title": "CPU Usage",
      "type": "stat",
      "targets": [
        {
          "expr": "100 - (avg(rate(node_cpu_seconds_total{mode=\"idle\"}[5m])) * 100)",
          "refId": "A"
        }
      ],
      "gridPos": { "x": 0, "y": 0, "w": 12, "h": 8 }
    }
  ],
  "templating": { "list": [] }
}

One stat panel is emitted with its PromQL query and an auto-computed top-left grid position.

Best Practices & Notes

Best Practices

  • Give each panel a specific, descriptive title (e.g. "Request Latency p99" rather than "Panel 1") since dashboard titles are what teammates scan during an incident.
  • Use a templating variable for anything you'll want to filter by repeatedly, like instance or job, instead of hardcoding one target into every query.
  • Keep queries simple per panel (one metric, one aggregation) rather than cramming multiple signals into a single expr, since stat and table panels render a single series poorly when the query returns many.

Developer Notes

The output is a Grafana dashboard JSON model (not a full API-wrapped dashboard object with folder/overwrite metadata), matching what Dashboards > Import expects when pasted directly. schemaVersion is pinned to 39 to match a recent Grafana schema; panel type names are translated via a fixed map (graph→timeseries, stat→stat, table→table) since Grafana renamed its legacy 'graph' panel to 'timeseries' several versions ago.

Grafana Dashboard Generator Use Cases

  • Scaffolding a new dashboard's JSON model for a service being instrumented for the first time
  • Generating a dashboard-as-code JSON file to check into version control next to a Prometheus config
  • Quickly sketching several PromQL panels to paste into Grafana's import screen instead of building them one at a time in the UI

Common Mistakes

  • Forgetting that Grafana will still prompt for a datasource on import since no datasource UID is set on panels; select your Prometheus datasource when prompted.
  • Filling in only one of a templating variable's name/query fields, which this tool rejects since a variable needs both to function.
  • Writing an overly broad PromQL query for a stat panel that returns multiple series, causing Grafana to only render one of them.

Tips

  • Use the Prometheus Config Generator first to make sure the scrape jobs backing your PromQL queries actually exist before building panels around them.
  • Leave gridPos fields blank for a quick first draft, then fine-tune positions inside Grafana's own drag-and-drop panel editor after import.

References

Frequently Asked Questions