2022-05-26 23:06:25 +08:00
---
aliases:
2022-12-10 00:36:04 +08:00
- ../../reference/dashboard/
- ../json-model/
2022-05-26 23:06:25 +08:00
keywords:
- grafana
- dashboard
- documentation
- json
- model
Explicitly set all front matter labels in the source files (#71548)
* Set every page to have defaults of 'Enterprise' and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration pages to have of 'Cloud', 'Enterprise', and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/enterprise-licensing pages to have 'Enterprise' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/organization-management pages to have 'Enterprise' and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/provisioning pages to have 'Enterprise' and 'Open source' labels
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/recorded-queries pages to have labels cloud,enterprise
* Set administration/roles-and-permissions/access-control pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set administration/stats-and-license pages to have labels cloud,enterprise
* Set alerting pages to have labels cloud,enterprise,oss
* Set breaking-changes pages to have labels cloud,enterprise,oss
* Set dashboards pages to have labels cloud,enterprise,oss
* Set datasources pages to have labels cloud,enterprise,oss
* Set explore pages to have labels cloud,enterprise,oss
* Set fundamentals pages to have labels cloud,enterprise,oss
* Set introduction/grafana-cloud pages to have labels cloud
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Fix introduction pages products
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set panels-visualizations pages to have labels cloud,enterprise,oss
* Set release-notes pages to have labels cloud,enterprise,oss
* Set search pages to have labels cloud,enterprise,oss
* Set setup-grafana/configure-security/audit-grafana pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set setup-grafana/configure-security/configure-authentication pages to have labels cloud,enterprise,oss
* Set setup-grafana/configure-security/configure-authentication/enhanced-ldap pages to have labels cloud,enterprise
* Set setup-grafana/configure-security/configure-authentication/saml pages to have labels cloud,enterprise
* Set setup-grafana/configure-security/configure-database-encryption/encrypt-secrets-using-hashicorp-key-vault pages to have labels cloud,enterprise
* Set setup-grafana/configure-security/configure-request-security pages to have labels cloud,enterprise,oss
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set setup-grafana/configure-security/configure-team-sync pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set setup-grafana/configure-security/export-logs pages to have labels cloud,enterprise
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
* Set troubleshooting pages to have labels cloud,enterprise,oss
* Set whatsnew pages to have labels cloud,enterprise,oss
* Apply updated labels from review
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
---------
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
2023-07-18 16:10:12 +08:00
labels:
products:
- cloud
- enterprise
- oss
2022-05-26 23:06:25 +08:00
title: JSON model
2023-12-15 03:15:55 +08:00
description: View your Grafana dashboard JSON object
2022-09-26 23:07:24 +08:00
weight: 700
2024-05-22 16:55:17 +08:00
refs:
annotations:
- pattern: /docs/grafana/
destination: /docs/grafana/< GRAFANA_VERSION > /dashboards/build-dashboards/annotate-visualizations/
- pattern: /docs/grafana-cloud/
2024-06-21 22:02:16 +08:00
destination: /docs/grafana-cloud/visualizations/dashboards/build-dashboards/annotate-visualizations/
2022-05-26 23:06:25 +08:00
---
2015-11-02 15:17:23 +08:00
2020-10-02 05:13:39 +08:00
# Dashboard JSON model
2015-11-02 15:17:23 +08:00
2018-02-08 16:55:12 +08:00
A dashboard in Grafana is represented by a JSON object, which stores metadata of its dashboard. Dashboard metadata includes dashboard properties, metadata from panels, template variables, panel queries, etc.
2015-11-02 15:17:23 +08:00
2021-02-10 14:57:38 +08:00
To view the JSON of a dashboard:
2015-11-02 15:17:23 +08:00
2024-06-21 22:02:16 +08:00
1. Click **Edit** in the top-right corner of the dashboard.
1. Click **Settings** .
1. Go to the **JSON Model** tab.
1. When you've finished viewing the JSON, click **Back to dashboard** and **Exit edit** .
2015-11-02 15:17:23 +08:00
2015-11-02 16:21:59 +08:00
## JSON fields
2015-11-02 15:17:23 +08:00
2015-11-02 15:53:24 +08:00
When a user creates a new dashboard, a new dashboard JSON object is initialized with the following fields:
2023-05-23 04:45:28 +08:00
{{% admonition type="note" %}}
In the following JSON, id is shown as null which is the default value assigned to it until a dashboard is saved. Once a dashboard is saved, an integer value is assigned to the `id` field.
{{% /admonition %}}
2015-11-02 15:17:23 +08:00
2017-10-06 01:01:03 +08:00
```json
2015-11-02 15:17:23 +08:00
{
"id": null,
2018-02-08 16:55:12 +08:00
"uid": "cLV5GDCkz",
2015-11-02 15:17:23 +08:00
"title": "New dashboard",
"tags": [],
"timezone": "browser",
2015-11-02 15:53:24 +08:00
"editable": true,
2016-12-14 21:33:33 +08:00
"graphTooltip": 1,
2018-02-08 16:55:12 +08:00
"panels": [],
2015-11-02 15:17:23 +08:00
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {
2015-11-02 16:21:59 +08:00
"refresh_intervals": []
2015-11-02 15:17:23 +08:00
},
"templating": {
"list": []
},
"annotations": {
"list": []
},
2018-05-09 03:25:45 +08:00
"refresh": "5s",
2018-08-20 21:33:49 +08:00
"schemaVersion": 17,
2015-11-02 15:17:23 +08:00
"version": 0,
"links": []
}
```
2021-08-06 21:52:36 +08:00
2015-11-02 15:53:24 +08:00
Each field in the dashboard JSON is explained below with its usage:
2020-10-01 03:45:07 +08:00
| Name | Usage |
| ----------------- | ----------------------------------------------------------------------------------------------------------------- |
| **id** | unique numeric identifier for the dashboard. (generated by the db) |
| **uid** | unique dashboard identifier that can be generated by anyone. string (8-40) |
| **title** | current title of dashboard |
| **tags** | tags associated with dashboard, an array of strings |
| **style** | theme of dashboard, i.e. `dark` or `light` |
| **timezone** | timezone of dashboard, i.e. `utc` or `browser` |
| **editable** | whether a dashboard is editable or not |
| **graphTooltip** | 0 for no shared crosshair or tooltip (default), 1 for shared crosshair, 2 for shared crosshair AND shared tooltip |
| **time** | time range for dashboard, i.e. last 6 hours, last 7 days, etc |
| **timepicker** | timepicker metadata, see [timepicker section ](#timepicker ) for details |
| **templating** | templating metadata, see [templating section ](#templating ) for details |
2024-05-22 16:55:17 +08:00
| **annotations** | annotations metadata, see [annotations ](ref:annotations ) for how to add them |
2020-10-01 03:45:07 +08:00
| **refresh** | auto-refresh interval |
| **schemaVersion** | version of the JSON schema (integer), incremented each time a Grafana update brings changes to said schema |
| **version** | version of the dashboard (integer), incremented each time the dashboard is updated |
| **panels** | panels array, see below for detail. |
2015-11-02 16:21:59 +08:00
2018-02-21 17:47:14 +08:00
## Panels
2015-11-02 16:21:59 +08:00
2019-09-20 06:04:56 +08:00
Panels are the building blocks of a dashboard. It consists of data source queries, type of graphs, aliases, etc. Panel JSON consists of an array of JSON objects, each representing a different panel. Most of the fields are common for all panels but some fields depend on the panel type. Following is an example of panel JSON of a text panel.
2015-11-03 02:15:40 +08:00
2017-02-07 14:48:01 +08:00
```json
2015-11-03 02:15:40 +08:00
"panels": [
2018-02-21 17:47:14 +08:00
{
"type": "text",
"title": "Panel Title",
"gridPos": {
"x": 0,
"y": 0,
"w": 12,
"h": 9
2015-11-02 16:21:59 +08:00
},
2018-02-21 17:47:14 +08:00
"id": 4,
"mode": "markdown",
"content": "# title"
}
2015-11-03 02:15:40 +08:00
```
2019-10-04 00:20:52 +08:00
### Panel size and position
2015-11-03 02:15:40 +08:00
2018-02-21 17:47:14 +08:00
The gridPos property describes the panel size and position in grid coordinates.
2015-11-03 02:15:40 +08:00
2021-08-06 21:52:36 +08:00
- `w` 1-24 (the width of the dashboard is divided into 24 columns)
2018-02-21 17:47:14 +08:00
- `h` In grid height units, each represents 30 pixels.
- `x` The x position, in same unit as `w` .
- `y` The y position, in same unit as `h` .
2015-11-03 02:15:40 +08:00
2018-03-30 22:42:48 +08:00
The grid has a negative gravity that moves panels up if there is empty space above a panel.
2015-11-02 16:21:59 +08:00
### timepicker
2017-02-07 14:48:01 +08:00
```json
2015-11-03 02:15:40 +08:00
"timepicker": {
"collapse": false,
"enable": true,
"notice": false,
"now": true,
2024-01-10 18:24:55 +08:00
"hidden": false,
"nowDelay": "",
2025-02-04 22:36:28 +08:00
"quick_ranges": [
{
"display": "Last 6 hours"
"from": "now-6h",
"to": "now"
},
{
"display": "Last 7 days"
"from": "now-7d",
"to": "now"
}
],
2015-11-03 02:15:40 +08:00
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"status": "Stable",
"type": "timepicker"
}
```
Usage of the fields is explained below:
2024-01-10 18:24:55 +08:00
| Name | Usage |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| **collapse** | whether timepicker is collapsed or not |
| **enable** | whether timepicker is enabled or not |
| **notice** | |
| **now** | |
| **hidden** | whether timepicker is hidden or not |
| **nowDelay** | override the now time by entering a time delay. Use this option to accommodate known delays in data aggregation to avoid null values. |
2025-02-04 22:36:28 +08:00
| **quick_ranges** | custom quick ranges |
2024-01-10 18:24:55 +08:00
| **refresh_intervals** | interval options available in the refresh picker dropdown |
| **status** | |
| **type** | |
2015-11-02 16:21:59 +08:00
### templating
2018-03-30 22:47:51 +08:00
The `templating` field contains an array of template variables with their saved values along with some other metadata, for example:
2015-11-03 02:15:40 +08:00
2017-02-07 14:48:01 +08:00
```json
2015-11-03 02:15:40 +08:00
"templating": {
"enable": true,
"list": [
{
"allFormat": "wildcard",
"current": {
"tags": [],
"text": "prod",
"value": "prod"
},
"datasource": null,
"includeAll": true,
"name": "env",
"options": [
{
"selected": false,
"text": "All",
"value": "*"
},
{
"selected": false,
"text": "stage",
"value": "stage"
},
{
"selected": false,
"text": "test",
"value": "test"
}
],
"query": "tag_values(cpu.utilization.average,env)",
"refresh": false,
"type": "query"
},
{
"allFormat": "wildcard",
"current": {
"text": "apache",
"value": "apache"
},
"datasource": null,
"includeAll": false,
"multi": false,
"multiFormat": "glob",
"name": "app",
"options": [
{
"selected": true,
"text": "tomcat",
"value": "tomcat"
},
{
"selected": false,
"text": "cassandra",
"value": "cassandra"
}
],
"query": "tag_values(cpu.utilization.average,app)",
2015-12-01 16:01:44 +08:00
"refresh": false,
2015-11-03 02:15:40 +08:00
"regex": "",
"type": "query"
}
]
}
```
Usage of the above mentioned fields in the templating section is explained below:
2020-10-01 03:45:07 +08:00
| Name | Usage |
| --------------- | ------------------------------------------------------------------------------------------------------- |
| **enable** | whether templating is enabled or not |
| **list** | an array of objects each representing one template variable |
| **allFormat** | format to use while fetching all values from data source, eg: `wildcard` , `glob` , `regex` , `pipe` , etc. |
| **current** | shows current selected variable text/value on the dashboard |
| **data source** | shows data source for the variables |
| **includeAll** | whether all value option is available or not |
| **multi** | whether multiple values can be selected or not from variable value list |
| **multiFormat** | format to use while fetching timeseries from data source |
| **name** | name of variable |
| **options** | array of variable text/value pairs available for selection on dashboard |
| **query** | data source query used to fetch values for a variable |
2023-12-18 23:31:33 +08:00
| **refresh** | configures when to refresh a variable |
| **regex** | extracts part of a series name or metric node segment |
2020-10-01 03:45:07 +08:00
| **type** | type of variable, i.e. `custom` , `query` or `interval` |