Added URL variables and changed content

This commit is contained in:
Diana Payton
2020-05-07 13:14:08 -07:00
parent 951dded9f4
commit 097d84b3c9
5 changed files with 80 additions and 15 deletions
@@ -9,7 +9,7 @@ parent = "linking"
weight = 1
+++
# Link dashboards
# Dashboard links
When you create a dashboard link, you can include the time range and current template variables to directly jump to the same context in another dashboard. This way, you don’t have to worry whether the person you send the link to is looking at the right data.
+12 -6
View File
@@ -13,9 +13,7 @@ weight = 400
You can use links to navigate between commonly-used dashboards or to connect others to your visualizations. Links let you create shortcuts to other dashboards, panels, and even external websites.
Grafana supports three types of links: Dashboard Links, Panel Links, and Data Links. They are all available from your dashboard.
{{< docs-imagebox img="/assets/img/blog/dashboard_links.png" max-width="800px" caption="Links Supported in Grafana" >}}
Grafana supports dashboard links and panel links. Dashboard links are displayed at the top of the dashboard. Panel links are accessible by clicking an icon on the top left corner of the panel.
## Which link should you use?
@@ -23,6 +21,14 @@ Start by figuring out how you're currently navigating between dashboards. If you
The next step is to figure out which link type is right for your workflow. Even though all the link types in Grafana are used to create shortcuts to other dashboards or external websites, they work in different contexts.
- If the link relates to most if not all of the panels in the dashboard, use a _dashboard link_.
- If you want to drill down into specific panels, use a _panel link_.
- If you want to drill down into a specific series, or even a single measurement, use a _data link_.
- If the link relates to most if not all of the panels in the dashboard, use [dashboard links]({{< relref "dashboard-links.md" >}}).
- If you want to drill down into specific panels, use [panel links]({{< relref "panel-links.md" >}}).
- If you want to link to an external site, you can use either type of link.
## Controlling time range using URL
You can control the time range of a panel or dashboard by providing following query parameters in dashboard URL:
- `from` - defines lower limit of the time range, specified in ms epoch
- `to` - defines upper limit of the time range, specified in ms epoch
- `time` and `time.window` - defines a time range from `time-time.window/2` to `time+time.window/2`. Both params should be specified in ms. For example `?time=1500000000000&time.window=10000` will result in 10s time range from 1499999995000 to 1500000005000
@@ -12,19 +12,25 @@ weight = 1
# Panel links
Each panel can have its own set of links that are shown in the upper left corner of the panel. You can link to any available URL, including dashboards, panels, or external sites. You can even [control the time range](https://grafana.com/docs/grafana/latest/reference/timerange/#controlling-time-range-using-url) to ensure the user is zoomed in on the right data in Grafana.
> **Note:** This documentation refers to the Grafana 7.0 beta UI.
Click the icon on the top left corner of a panel to see available panel links. To see an example of panel links in action, check out [this demo](https://play.grafana.org/d/000000156/dashboard-with-panel-link?orgId=1).
Each panel can have its own set of links that are shown in the upper left corner of the panel. You can link to any available URL, including dashboards, panels, or external sites. You can even control the time range to ensure the user is zoomed in on the right data in Grafana.
Click the icon on the top left corner of a panel to see available panel links.
<img class="no-shadow" src="/img/docs/linking/panel-links.png" width="500px">
## Add a panel link
1. Hover your cursor over the panel that you want to add a link to and then press `e`. Or click the dropdown arrow next to the panel title and then click **Edit**.
2. Open the **General** tab in the panel settings and then scroll down to the Panel links section.
3. Click **Add link**.
4. Enter a **Title**.
5. If you want the link to open in a new tab, then select **Open in a new tab**.
6. Enter the **URL** you want to link to.
You can even add one of the template variables that are available. Press Ctrl+Space in the **URL** field to see the available variables. By adding template variables to your panel ink, the link sends the user to the right context, with the relevant variables already set.
1. On the Panel tab, scroll down to the Links section.
1. Expand Links and then click **Add link**.
1. Enter a **Title**.
1. Enter the **URL** you want to link to.
You can even add one of the template variables that are available. Press Ctrl+Space in the **URL** field to see the available variables. By adding template variables to your panel link, the link sends the user to the right context, with the relevant variables already set.
1. If you want the link to open in a new tab, then select **Open in a new tab**.
1. Click **Save** to save changes and close the window.
1. Click **Save** in the upper right to save your changes to the dashboard.
## Update a panel link
+2
View File
@@ -198,6 +198,8 @@
name: Overview
- link: /variables/global-variables/
name: Global variables
- link: /variables/url-variables/
name: URL variables
- link: /variables/advanced-variable-format-options/
name: Advanced variable formats
- link: /variables/repeat-panels-or-rows/
+51
View File
@@ -0,0 +1,51 @@
+++
title = "URL variables"
keywords = ["grafana", "url variables", "documentation", "variables"]
type = "docs"
+++
# URL variables
You can use variables in URLs to link to specific portions of your visualizations. For more information about linking, refer to [Dashboard links]({{< relref "../linking/dashboard-links.md" >}}) and [Panel links]({{< relref "../linking/panel-links.md" >}}).
> **Note:** These variables changed in 6.4 so if you have an older version of Grafana please use the version picker to select
docs for an older version of Grafana.
## Typeahead suggestions
Press Cmd+Space or Ctrl+Space on your keyboard to open the typeahead suggestions to more easily add variables to your URL.
{{< docs-imagebox img="/img/docs/data_link_typeahead.png" max-width= "800px" >}}
## Time variables
* ``__url_time_range`` - current dashboard's time range (i.e. ``?from=now-6h&to=now``)
* ``__from`` - current dashboard's time range from value
* ``__to`` - current dashboard's time range to value
## Series variables
Series specific variables are available under ``__series`` namespace:
* ``__series.name`` - series name to the URL
* ``__series.labels.<LABEL>`` - label's value to the URL. If your label contains dots use ``__series.labels["<LABEL>"]`` syntax
## Field variables
Field specific variables are available under ``__field`` namespace:
* ``__field.name`` - field name to the URL
## Value variables
Value specific variables are available under ``__value`` namespace:
* ``__value.time`` - value's timestamp (Unix ms epoch) to the URL (i.e. ``?time=1560268814105``)
* ``__value.raw`` - raw value
* ``__value.numeric`` - numeric representation of a value
* ``__value.text`` - text representation of a value
* ``__value.calc`` - calculation name if the value is result of calculation
## Template variables
When linking to another dashboard that uses template variables, you can use ``var-myvar=${myvar}`` syntax (where ``myvar`` is a name of template variable)
to use current dashboard's variable value. If you want to add all of the current dashboard's variables to the URL use ``__all_variables`` variable.