Docs: Remove reference folder (#27944)

* Delete stack_guide_graphite.md

* moved json-model

* Moved Export and import

* Delete _index.md

* Moved Scripted dashboards

* Moved Share dashboard

* fixed links
This commit is contained in:
Diana Payton
2020-10-01 14:13:39 -07:00
committed by GitHub
parent 5f41818766
commit 715f0133ee
11 changed files with 31 additions and 298 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ Dashboards can use [templating]({{< relref "../variables/templates-and-variables
Dashboards can use [annotations]({{< relref "annotations.md" >}}) to display event data across panels. This can help correlate the time series data in the panel with other events.
Dashboards can be [shared]({{< relref "../reference/share_dashboard.md" >}}) easily in a variety of ways.
Dashboards can be [shared]({{< relref "share-dashboard.md" >}}) easily in a variety of ways.
Dashboards can be tagged, and the dashboard picker provides quick, searchable access to all dashboards in a particular organization.
+112
View File
@@ -0,0 +1,112 @@
+++
title = "Export and import"
keywords = ["grafana", "dashboard", "documentation", "export", "import"]
type = "docs"
aliases = ["/docs/grafana/latest/reference/export_import/"]
[menu.docs]
parent = "dashboard_features"
weight = 800
+++
# Export and import
Grafana Dashboards can easily be exported and imported, either from the UI or from the [HTTP API]({{< relref "../http_api/dashboard.md#create-update-dashboard" >}}).
## Exporting a dashboard
Dashboards are exported in Grafana JSON format, and contain everything you need (layout, variables, styles, data sources, queries, etc) to import the dashboard at a later time.
The export feature is accessed in the share window which you open by clicking the share button in the dashboard menu.
{{< docs-imagebox img="/img/docs/export/export-modal.png" max-width="800px" >}}
### Making a dashboard portable
If you want to export a dashboard for others to use then it could be a good idea to
add template variables for things like a metric prefix (use constant variable) and server name.
A template variable of the type `Constant` will automatically be hidden in
the dashboard, and will also be added as a required input when the dashboard is imported.
## Importing a dashboard
To import a dashboard click the + icon in the side menu, and then click **Import**.
{{< docs-imagebox img="/img/docs/v70/import_step1.png" max-width="700px" >}}
From here you can upload a dashboard JSON file, paste a [Grafana.com](https://grafana.com) dashboard
URL or paste dashboard JSON text directly into the text area.
{{< docs-imagebox img="/img/docs/v70/import_step2_grafana.com.png" max-width="700px" >}}
In step 2 of the import process Grafana will let you change the name of the dashboard, pick what
data source you want the dashboard to use and specify any metric prefixes (if the dashboard use any).
## Discover dashboards on Grafana.com
Find dashboards for common server applications at [Grafana.com/dashboards](https://grafana.com/dashboards).
{{< docs-imagebox img="/img/docs/v50/gcom_dashboard_list.png" max-width="700px" >}}
## Import and sharing with Grafana 2.x or 3.0
Dashboards on Grafana.com use a new feature in Grafana 3.1 that allows the import process
to update each panel so that they are using a data source of your choice. If you are running a
Grafana version older than 3.1 then you might need to do some manual steps either
before or after import in order for the dashboard to work properly.
Dashboards exported from Grafana 3.1+ have a new json section `__inputs`
that define what data sources and metric prefixes the dashboard uses.
Example:
```json
{
"__inputs": [
{
"name": "DS_GRAPHITE",
"label": "graphite",
"description": "",
"type": "datasource",
"pluginId": "graphite",
"pluginName": "Graphite"
},
{
"name": "VAR_PREFIX",
"type": "constant",
"label": "prefix",
"value": "collectd",
"description": ""
}
]
}
```
These are then referenced in the dashboard panels like this:
```json
{
"rows": [
{
"panels": [
{
"type": "graph",
"datasource": "${DS_GRAPHITE}"
}
]
}
]
}
```
These inputs and their usage in data source properties are automatically added during export in Grafana 3.1.
If you run an older version of Grafana and want to share a dashboard on Grafana.com you need to manually
add the inputs and templatize the data source properties like above.
If you want to import a dashboard from Grafana.com into an older version of Grafana then you can either import
it as usual and then update the data source option in the metrics tab so that the panel is using the correct
data source. Another alternative is to open the json file in a text editor and update the data source properties
to value that matches a name of your data source.
## Note
In Grafana v5.3.4+ the export modal has new checkbox for sharing for external use (other instances). If the checkbox is not checked then the `__inputs` section will not be included in the exported JSON file.
+238
View File
@@ -0,0 +1,238 @@
+++
title = "JSON model"
keywords = ["grafana", "dashboard", "documentation", "json", "model"]
type = "docs"
aliases = ["/docs/grafana/latest/reference/dashboard/"]
[menu.docs]
name = "JSON Model"
parent = "dashboard_features"
weight = 1200
+++
# Dashboard JSON model
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:
1. Go to a dashboard
1. Click on `Manage dashboard` menu on the top navigation bar
1. 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.
```json
{
"id": null,
"uid": "cLV5GDCkz",
"title": "New dashboard",
"tags": [],
"style": "dark",
"timezone": "browser",
"editable": true,
"hideControls": false,
"graphTooltip": 1,
"panels": [],
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {
"time_options": [],
"refresh_intervals": []
},
"templating": {
"list": []
},
"annotations": {
"list": []
},
"refresh": "5s",
"schemaVersion": 17,
"version": 0,
"links": []
}
```
Each field in the dashboard JSON is explained below with its usage:
| 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 |
| **annotations** | annotations metadata, see [annotations section](#annotations) for details |
| **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. |
## Panels
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.
```json
"panels": [
{
"type": "text",
"title": "Panel Title",
"gridPos": {
"x": 0,
"y": 0,
"w": 12,
"h": 9
},
"id": 4,
"mode": "markdown",
"content": "# title"
}
```
### Panel size and 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
```json
"timepicker": {
"collapse": false,
"enable": true,
"notice": false,
"now": true,
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"status": "Stable",
"type": "timepicker"
}
```
Usage of the fields is explained below:
| Name | Usage |
| --------------------- | -------------------------------------- |
| **collapse** | whether timepicker is collapsed or not |
| **enable** | whether timepicker is enabled or not |
| **notice** | TODO |
| **now** | TODO |
| **refresh_intervals** | TODO |
| **status** | TODO |
| **type** | TODO |
### templating
The `templating` field contains an array of template variables with their saved values along with some other metadata, for example:
```json
"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)",
"refresh": false,
"regex": "",
"type": "query"
}
]
}
```
Usage of the above mentioned fields in the templating section is explained below:
| 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 |
| **refresh** | TODO |
| **regex** | TODO |
| **type** | type of variable, i.e. `custom`, `query` or `interval` |
@@ -0,0 +1,58 @@
+++
title = "Scripted dashboards"
keywords = ["grafana", "dashboard", "documentation", "scripted"]
type = "docs"
aliases = ["/docs/grafana/latest/reference/scripting/"]
[menu.docs]
parent = "dashboard_features"
weight = 1500
+++
# Scripted dashboards
> **Warning:** This feature is deprecated and will be removed in a future release.
If you have lots of metric names that change (new servers etc) in a defined pattern it is irritating to constantly have to create new dashboards.
With scripted dashboards you can dynamically create your dashboards using javascript. In the grafana install folder
under `public/dashboards/` there is a file named `scripted.js`. This file contains an example of a scripted dashboard. You can access it by using the URL:
`http://grafana_url/dashboard/script/scripted.js?rows=3&name=myName`
If you open scripted.js you can see how it reads URL parameters from ARGS variable and then adds rows and panels.
## Example
```javascript
var seriesName = 'argName';
if (!_.isUndefined(ARGS.name)) {
seriesName = ARGS.name;
}
dashboard.panels.push({
title: 'Events',
type: 'graph',
fill: 1,
linewidth: 2,
gridPos: {
h: 10,
w: 24,
x: 0,
y: 10,
},
targets: [
{
target: "randomWalk('" + seriesName + "')",
},
{
target: "randomWalk('random walk2')",
},
],
});
return dashboard;
```
## More examples
You can find more examples in `public/dashboards/` directory of your grafana installation.
@@ -0,0 +1,30 @@
+++
title = "Share dashboard"
keywords = ["grafana", "dashboard", "documentation", "sharing"]
type = "docs"
aliases = ["/docs/grafana/latest/reference/share_dashboard/"]
[menu.docs]
parent = "dashboard_features"
weight = 500
+++
# Share dashboard
Share a dashboard via the share icon in the top nav. This opens the share dialog where you
can get a link to the current dashboard with the current selected time range and template variables. If you have
made changes to the dashboard, make sure those are saved before sending the link. Below are ways to share a dashboard.
## Dashboard snapshot
A dashboard snapshot is an instant way to share an interactive dashboard publicly. When created, we <strong>strip sensitive data</strong> like queries
(metric, template and annotation) and panel links, leaving only the visible metric data and series names embedded into your dashboard. Dashboard
snapshots can be accessed by anyone who has the link and can reach the URL.
{{< docs-imagebox img="/img/docs/v50/share_panel_modal.png" max-width="700px" >}}
## Publish snapshots
You can publish snapshots to your local instance or to [snapshot.raintank.io](http://snapshot.raintank.io). The latter is a free service
provided by Grafana Labs, that allows you to publish dashboard snapshots to an external Grafana instance.
The same rules still apply, anyone with the link can view it. You can set an expiration time if you want the snapshot to be removed
after a certain time period.
+58
View File
@@ -0,0 +1,58 @@
+++
title = "Share panel"
keywords = ["grafana", "dashboard", "documentation", "sharing"]
type = "docs"
aliases = ["/docs/grafana/latest/reference/share_panel/"]
[menu.docs]
parent = "dashboard_features"
weight = 600
+++
# Share a panel
Click a panel title to open the panel menu, then click share in the panel menu to open the Share Panel dialog. Here you have access to a link that will take you to exactly this panel with the current time range and selected template variables. Below are ways to share a panel.
## Direct Link Rendered Image
You also get a link to render a .png image of the panel, which is useful if you want to share an image of the panel. For more information about the requirements and how to configure image rendering, refer to [Image rendering]({{< relref "../administration/image_rendering.md)" >}}.
Example of a link to a server-side rendered PNG:
```bash
https://play.grafana.org/d/000000012/grafana-play-home?orgId=1&from=1568719680173&to=1568726880174&panelId=4&fullscreen
```
#### Query String Parameters For Server-Side Rendered Images
- **width**: width in pixels. Default is 800.
- **height**: height in pixels. Default is 400.
- **tz**: timezone in the format `UTC%2BHH%3AMM` where HH and MM are offset in hours and minutes after UTC
- **timeout**: number of seconds. The timeout can be increased if the query for the panel needs more than the default 30 seconds.
- **scale**: numeric value to configure device scale factor. Default is 1. Use a higher value to produce more detailed images (higher DPI). Supported in Grafana v7.0+.
## Embed Panel
You can embed a panel using an iframe on another web site. This tab will show you the html that you need to use.
> **Note:** This sharing requires [allow_embedding]({{< relref "../administration/configuration.md#allow-embedding" >}}) enabled and anonymous access, or proper configuration of the [cookie_samesite]({{< relref "../administration/configuration.md#cookie-samesite" >}}) setting.
Example:
```html
<iframe src="https://snapshot.raintank.io/dashboard-solo/snapshot/y7zwi2bZ7FcoTlB93WN7yWO4aMiz3pZb?from=1493369923321&to=1493377123321&panelId=4" width="650" height="300" frameborder="0"></iframe>
```
Below there should be an interactive Grafana graph embedded in an iframe:
<iframe src="https://snapshot.raintank.io/dashboard-solo/snapshot/y7zwi2bZ7FcoTlB93WN7yWO4aMiz3pZb?from=1493369923321&to=1493377123321&panelId=4" width="650" height="300" frameborder="0"></iframe>
#### Export Panel Data
{{< docs-imagebox img="/img/docs/v50/export_panel_data.png" max-width="500px" >}}
The submenu for a panel can be found by clicking on the title of a panel and then on the More submenu.
This menu contains two options for exporting data:
- The panel JSON (the specification and not the data) can be exported or updated via the panel context menu.
- Panel data can be exported in the CSV format for Table and Graph Panels.