Grafana Reference
Free reference guide: Grafana Reference
About Grafana Reference
This Grafana Reference is a searchable cheat sheet for Grafana observability platform configuration. It covers dashboard JSON model structure, template variables ($variable syntax, query/custom/interval/multi-value/chained variables), dashboard annotations, links, and file-based provisioning with YAML configuration.
The reference includes panel types (time series, stat, table, gauge) with field config and threshold examples, alerting rules with PromQL expressions, contact points (Slack, Email, PagerDuty), notification policies and routing, silence/mute timing, and datasource provisioning for Prometheus, Loki, InfluxDB, and Elasticsearch.
Designed for DevOps engineers, SREs, platform engineers, and monitoring specialists who need quick access to Grafana dashboard JSON snippets, variable syntax, alert configuration, datasource YAML templates, plugin development patterns, and Grafana HTTP API endpoints.
Key Features
- Dashboard JSON model with panels array, time range configuration, and provisioning YAML
- Template variable reference: query, custom, interval, multi-value, and chained variable patterns
- Panel configuration for time series, stat, table, and gauge types with thresholds and overrides
- Grafana Alerting setup: alert rules with PromQL, contact points, notification policies, and mute timing
- Datasource provisioning YAML for Prometheus, Loki, InfluxDB, and Elasticsearch
- Plugin development guide for custom panels and datasource plugins with create-plugin CLI
- Grafana HTTP API examples for dashboard CRUD operations with bearer token authentication
- Filterable by category: Dashboard, Panel, Variables, Alerting, Datasource, Plugins
Frequently Asked Questions
How do I define a Grafana dashboard in JSON?
A Grafana dashboard JSON model contains a dashboard object with title, panels array, and time range (from/to). Each panel specifies its type (timeseries, stat, table, gauge), targets with datasource queries, and fieldConfig for units and thresholds. You can import/export dashboards as JSON through the Grafana UI or API.
How do template variables work in Grafana?
Template variables are referenced as $variable or ${variable} in queries. Query variables pull values from datasources (e.g., label_values(up, instance)), custom variables use comma-separated static values, interval variables define time ranges for rate queries, and chained variables create dependent dropdowns where changing one variable refreshes another.
How do I set up Grafana alerts?
Define alert rules with PromQL expressions (e.g., avg(rate(node_cpu_seconds_total{mode="idle"}[5m])) < 0.2), set evaluation duration with "for" parameter, add severity labels, and configure annotations. Set up contact points (Slack webhook, Email, PagerDuty) and notification policies to route alerts by label matching.
How do I provision datasources in Grafana?
Create YAML files in /etc/grafana/provisioning/datasources/. Each datasource entry needs name, type (prometheus, loki, influxdb, elasticsearch), URL, and access mode. For Prometheus, set url to http://prometheus:9090 with proxy access. For Loki, configure maxLines and optional derivedFields for trace correlation.
What panel types does Grafana support?
Key panel types include: Time Series for metric visualization with rate queries, Stat for single-value displays with color modes, Table for tabular data with instant queries, and Gauge for threshold-based visualization with color steps (green/yellow/red). Each supports field config overrides for per-series customization.
How do I develop custom Grafana plugins?
Use npx @grafana/create-plugin@latest to scaffold a plugin project. Panel plugins define visualization components, while datasource plugins extend DataSourceApi with a query method that processes DataQueryRequest objects. Define plugin metadata in plugin.json with type, name, and unique id.
How do I use the Grafana HTTP API?
Authenticate with Bearer token in the Authorization header. GET /api/search?type=dash-db lists dashboards. POST /api/dashboards/db with a JSON body creates or updates dashboards. The API supports full CRUD operations for dashboards, datasources, alert rules, and user management.
Is this Grafana reference free to use?
Yes, this Grafana cheat sheet is completely free with no account required. All dashboard JSON snippets, variable syntax, and YAML configurations are searchable and filterable by category in your browser. It is part of liminfo.com's collection of free DevOps reference tools.