Dashboard JSON

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.

To view the JSON of a dashboard, follow the steps mentioned below:

  • Go to a dashboard
  • Click on Manage dashboard menu on the top navigation bar
  • Select View JSON from the dropdown menu

JSON fields

When a user creates a new dashboard, a new dashboard JSON object is initialized with the following fields:

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.

  1. {
  2. "id": null,
  3. "uid": "cLV5GDCkz",
  4. "title": "New dashboard",
  5. "tags": [],
  6. "style": "dark",
  7. "timezone": "browser",
  8. "editable": true,
  9. "hideControls": false,
  10. "graphTooltip": 1,
  11. "panels": [],
  12. "time": {
  13. "from": "now-6h",
  14. "to": "now"
  15. },
  16. "timepicker": {
  17. "time_options": [],
  18. "refresh_intervals": []
  19. },
  20. "templating": {
  21. "list": []
  22. },
  23. "annotations": {
  24. "list": []
  25. },
  26. "refresh": "5s",
  27. "schemaVersion": 17,
  28. "version": 0,
  29. "links": []
  30. }

Each field in the dashboard JSON is explained below with its usage:

NameUsage
idunique numeric identifier for the dashboard. (generated by the db)
uidunique dashboard identifier that can be generated by anyone. string (8-40)
titlecurrent title of dashboard
tagstags associated with dashboard, an array of strings
styletheme of dashboard, i.e. dark or light
timezonetimezone of dashboard, i.e. utc or browser
editablewhether a dashboard is editable or not
graphTooltip0 for no shared crosshair or tooltip (default), 1 for shared crosshair, 2 for shared crosshair AND shared tooltip
timetime range for dashboard, i.e. last 6 hours, last 7 days, etc
timepickertimepicker metadata, see timepicker section for details
templatingtemplating metadata, see templating section for details
annotationsannotations metadata, see annotations section for details
refreshauto-refresh interval
schemaVersionversion of the JSON schema (integer), incremented each time a Grafana update brings changes to said schema
versionversion of the dashboard (integer), incremented each time the dashboard is updated
panelspanels array, see below for detail.

Panels

Panels are the building blocks of a dashboard. It consists of datasource 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.

  1. "panels": [
  2. {
  3. "type": "text",
  4. "title": "Panel Title",
  5. "gridPos": {
  6. "x": 0,
  7. "y": 0,
  8. "w": 12,
  9. "h": 9
  10. },
  11. "id": 4,
  12. "mode": "markdown",
  13. "content": "# title"
  14. }

Panel size & position

The gridPos property describes the panel size and position in grid coordinates.

  • w 1-24 (the width of the dashboard is divided into 24 columns)
  • 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.The grid has a negative gravity that moves panels up if there is empty space above a panel.

timepicker

  1. "timepicker": {
  2. "collapse": false,
  3. "enable": true,
  4. "notice": false,
  5. "now": true,
  6. "refresh_intervals": [
  7. "5s",
  8. "10s",
  9. "30s",
  10. "1m",
  11. "5m",
  12. "15m",
  13. "30m",
  14. "1h",
  15. "2h",
  16. "1d"
  17. ],
  18. "status": "Stable",
  19. "time_options": [
  20. "5m",
  21. "15m",
  22. "1h",
  23. "3h",
  24. "6h",
  25. "12h",
  26. "24h",
  27. "2d",
  28. "3d",
  29. "4d",
  30. "7d",
  31. "30d"
  32. ],
  33. "type": "timepicker"
  34. }

Usage of the fields is explained below:

NameUsage
collapsewhether timepicker is collapsed or not
enablewhether timepicker is enabled or not
noticeTODO
nowTODO
refresh_intervalsTODO
statusTODO
time_optionsTODO
typeTODO

templating

The templating field contains an array of template variables with their saved values along with some other metadata, for example:

  1. "templating": {
  2. "enable": true,
  3. "list": [
  4. {
  5. "allFormat": "wildcard",
  6. "current": {
  7. "tags": [],
  8. "text": "prod",
  9. "value": "prod"
  10. },
  11. "datasource": null,
  12. "includeAll": true,
  13. "name": "env",
  14. "options": [
  15. {
  16. "selected": false,
  17. "text": "All",
  18. "value": "*"
  19. },
  20. {
  21. "selected": false,
  22. "text": "stage",
  23. "value": "stage"
  24. },
  25. {
  26. "selected": false,
  27. "text": "test",
  28. "value": "test"
  29. }
  30. ],
  31. "query": "tag_values(cpu.utilization.average,env)",
  32. "refresh": false,
  33. "refresh": false,
  34. "type": "query"
  35. },
  36. {
  37. "allFormat": "wildcard",
  38. "current": {
  39. "text": "apache",
  40. "value": "apache"
  41. },
  42. "datasource": null,
  43. "includeAll": false,
  44. "multi": false,
  45. "multiFormat": "glob",
  46. "name": "app",
  47. "options": [
  48. {
  49. "selected": true,
  50. "text": "tomcat",
  51. "value": "tomcat"
  52. },
  53. {
  54. "selected": false,
  55. "text": "cassandra",
  56. "value": "cassandra"
  57. }
  58. ],
  59. "query": "tag_values(cpu.utilization.average,app)",
  60. "refresh": false,
  61. "regex": "",
  62. "type": "query"
  63. }
  64. ]
  65. }

Usage of the above mentioned fields in the templating section is explained below:

NameUsage
enablewhether templating is enabled or not
listan array of objects each representing one template variable
allFormatformat to use while fetching all values from datasource, eg: wildcard, glob, regex, pipe, etc.
currentshows current selected variable text/value on the dashboard
datasourceshows datasource for the variables
includeAllwhether all value option is available or not
multiwhether multiple values can be selected or not from variable value list
multiFormatformat to use while fetching timeseries from datasource
namename of variable
optionsarray of variable text/value pairs available for selection on dashboard
querydatasource query used to fetch values for a variable
refreshTODO
regexTODO
typetype of variable, i.e. custom, query or interval