Commit ab4f8c27 by Daniel Lee

docs: describes variable formatting options

csv option in postgres/mysql docs and the regex option in the
graphite docs
parent 120a86ec
...@@ -38,13 +38,13 @@ Proxy access means that the Grafana backend will proxy all requests from the bro ...@@ -38,13 +38,13 @@ Proxy access means that the Grafana backend will proxy all requests from the bro
## Metric editor ## Metric editor
### Navigate metric segments ### Navigate metric segments
Click the ``Select metric`` link to start navigating the metric space. One you start you can continue using the mouse Click the ``Select metric`` link to start navigating the metric space. One you start you can continue using the mouse
or keyboard arrow keys. You can select a wildcard and still continue. or keyboard arrow keys. You can select a wildcard and still continue.
{{< docs-imagebox img="/img/docs/v45/graphite_query1_still.png" {{< docs-imagebox img="/img/docs/v45/graphite_query1_still.png"
animated-gif="/img/docs/v45/graphite_query1.gif" >}} animated-gif="/img/docs/v45/graphite_query1.gif" >}}
### Functions ### Functions
Click the plus icon to the right to add a function. You can search for the function or select it from the menu. Once Click the plus icon to the right to add a function. You can search for the function or select it from the menu. Once
...@@ -55,7 +55,6 @@ by the x icon. ...@@ -55,7 +55,6 @@ by the x icon.
{{< docs-imagebox img="/img/docs/v45/graphite_query2_still.png" {{< docs-imagebox img="/img/docs/v45/graphite_query2_still.png"
animated-gif="/img/docs/v45/graphite_query2.gif" >}} animated-gif="/img/docs/v45/graphite_query2.gif" >}}
### Optional parameters ### Optional parameters
Some functions like aliasByNode support an optional second argument. To add this parameter specify for example 3,-2 as the first parameter and the function editor will adapt and move the -2 to a second parameter. To remove the second optional parameter just click on it and leave it blank and the editor will remove it. Some functions like aliasByNode support an optional second argument. To add this parameter specify for example 3,-2 as the first parameter and the function editor will adapt and move the -2 to a second parameter. To remove the second optional parameter just click on it and leave it blank and the editor will remove it.
...@@ -63,7 +62,6 @@ Some functions like aliasByNode support an optional second argument. To add this ...@@ -63,7 +62,6 @@ Some functions like aliasByNode support an optional second argument. To add this
{{< docs-imagebox img="/img/docs/v45/graphite_query3_still.png" {{< docs-imagebox img="/img/docs/v45/graphite_query3_still.png"
animated-gif="/img/docs/v45/graphite_query3.gif" >}} animated-gif="/img/docs/v45/graphite_query3.gif" >}}
### Nested Queries ### Nested Queries
You can reference queries by the row “letter” that they’re on (similar to Microsoft Excel). If you add a second query to a graph, you can reference the first query simply by typing in #A. This provides an easy and convenient way to build compounded queries. You can reference queries by the row “letter” that they’re on (similar to Microsoft Excel). If you add a second query to a graph, you can reference the first query simply by typing in #A. This provides an easy and convenient way to build compounded queries.
...@@ -71,7 +69,6 @@ You can reference queries by the row “letter” that they’re on (similar to ...@@ -71,7 +69,6 @@ You can reference queries by the row “letter” that they’re on (similar to
{{< docs-imagebox img="/img/docs/v45/graphite_nested_queries_still.png" {{< docs-imagebox img="/img/docs/v45/graphite_nested_queries_still.png"
animated-gif="/img/docs/v45/graphite_nested_queries.gif" >}} animated-gif="/img/docs/v45/graphite_nested_queries.gif" >}}
## Point consolidation ## Point consolidation
All Graphite metrics are consolidated so that Graphite doesn't return more data points than there are pixels in the graph. By default, All Graphite metrics are consolidated so that Graphite doesn't return more data points than there are pixels in the graph. By default,
...@@ -97,7 +94,7 @@ Query | Description ...@@ -97,7 +94,7 @@ Query | Description
*tags(server=~backend\*)* | Returns only tags that occur in series matching the filter expression. *tags(server=~backend\*)* | Returns only tags that occur in series matching the filter expression.
*tag_values(server)* | Return tag values for the specified tag. *tag_values(server)* | Return tag values for the specified tag.
*tag_values(server, server=~backend*)* | Returns filtered tag values that occur for the specified tag in series matching those expressions. *tag_values(server, server=~backend*)* | Returns filtered tag values that occur for the specified tag in series matching those expressions.
*tag_values(server, server=~backend*, app=$apps)* | Multiple filter expressions and expressions can contain other variables. *tag_values(server, server=~backend*, app=${apps:regex})* | Multiple filter expressions and expressions can contain other variables.
For more details, see the [Graphite docs on the autocomplete api for tags](http://graphite.readthedocs.io/en/latest/tags.html#auto-complete-support). For more details, see the [Graphite docs on the autocomplete api for tags](http://graphite.readthedocs.io/en/latest/tags.html#auto-complete-support).
...@@ -109,14 +106,10 @@ variable with all possible values that exist in the wildcard position. ...@@ -109,14 +106,10 @@ variable with all possible values that exist in the wildcard position.
You can also create nested variables that use other variables in their definition. For example You can also create nested variables that use other variables in their definition. For example
`apps.$app.servers.*` uses the variable `$app` in its query definition. `apps.$app.servers.*` uses the variable `$app` in its query definition.
### Query Variables in Tag Queries ### Variable Usage
Multi-value variables in tag queries use the syntax introduced in Grafana 5.0 for variables: `{var:regex}`. Non-tag queries will use the default glob formatting for multi-value variables. Checkout the [Advanced Formatting Options section in the Templating]({{< relref "reference/templating.md#advanced-formatting-options" >}}) documentation for examples and details.
### Variable usage
You can use a variable in a metric node path or as a parameter to a function. You can use a variable in a metric node path or as a parameter to a function.
![](/img/docs/v2/templated_variable_parameter.png) ![variable](/img/docs/v2/templated_variable_parameter.png)
There are two syntaxes: There are two syntaxes:
...@@ -129,6 +122,10 @@ the second syntax in expressions like `my.server[[serverNumber]].count`. ...@@ -129,6 +122,10 @@ the second syntax in expressions like `my.server[[serverNumber]].count`.
Example: Example:
[Graphite Templated Dashboard](http://play.grafana.org/dashboard/db/graphite-templated-nested) [Graphite Templated Dashboard](http://play.grafana.org/dashboard/db/graphite-templated-nested)
### Variable Usage in Tag Queries
Multi-value variables in tag queries use the advanced formatting syntax introduced in Grafana 5.0 for variables: `{var:regex}`. Non-tag queries will use the default glob formatting for multi-value variables. Checkout the [Advanced Formatting Options section in the Variables]({{< relref "reference/templating.md#advanced-formatting-options" >}}) documentation for examples and details.
## Annotations ## Annotations
[Annotations]({{< relref "reference/annotations.md" >}}) allows you to overlay rich event information on top of graphs. You add annotation [Annotations]({{< relref "reference/annotations.md" >}}) allows you to overlay rich event information on top of graphs. You add annotation
......
...@@ -200,6 +200,14 @@ WHERE $__timeFilter(atimestamp) and hostname in([[hostname]]) ...@@ -200,6 +200,14 @@ WHERE $__timeFilter(atimestamp) and hostname in([[hostname]])
ORDER BY atimestamp ASC ORDER BY atimestamp ASC
``` ```
#### Disabling Quoting for Multi-value Variables
Grafana automatically creates a quoted, comma-separated string for multi-value variables. For example: if `server01` and `server02` are selected then it will be formatted as: `'server01', 'server02'. Do disable quoting, use the csv formatting option for variables:
`${servers:csv}`
Read more about variable formatting options in the [Variables]({{< relref "reference/templating.md#advanced-formatting-options" >}}) documentation.
## Annotations ## Annotations
[Annotations]({{< relref "reference/annotations.md" >}}) allows you to overlay rich event information on top of graphs. You add annotation queries via the Dashboard menu / Annotations view. [Annotations]({{< relref "reference/annotations.md" >}}) allows you to overlay rich event information on top of graphs. You add annotation queries via the Dashboard menu / Annotations view.
......
...@@ -82,7 +82,7 @@ You can control the name of the Table panel columns by using regular `as ` SQL c ...@@ -82,7 +82,7 @@ You can control the name of the Table panel columns by using regular `as ` SQL c
The resulting table panel: The resulting table panel:
![](/img/docs/v46/postgres_table.png) ![postgres table](/img/docs/v46/postgres_table.png)
### Time series queries ### Time series queries
...@@ -190,6 +190,14 @@ WHERE $__timeFilter(atimestamp) and hostname in([[hostname]]) ...@@ -190,6 +190,14 @@ WHERE $__timeFilter(atimestamp) and hostname in([[hostname]])
ORDER BY atimestamp ASC ORDER BY atimestamp ASC
``` ```
#### Disabling Quoting for Multi-value Variables
Grafana automatically creates a quoted, comma-separated string for multi-value variables. For example: if `server01` and `server02` are selected then it will be formatted as: `'server01', 'server02'. Do disable quoting, use the csv formatting option for variables:
`${servers:csv}`
Read more about variable formatting options in the [Variables]({{< relref "reference/templating.md#advanced-formatting-options" >}}) documentation.
## Annotations ## Annotations
[Annotations]({{< relref "reference/annotations.md" >}}) allow you to overlay rich event information on top of graphs. You add annotation queries via the Dashboard menu / Annotations view. [Annotations]({{< relref "reference/annotations.md" >}}) allow you to overlay rich event information on top of graphs. You add annotation queries via the Dashboard menu / Annotations view.
...@@ -218,9 +226,9 @@ tags | Optional field name to use for event tags as a comma separated string. ...@@ -218,9 +226,9 @@ tags | Optional field name to use for event tags as a comma separated string.
Time series queries should work in alerting conditions. Table formatted queries is not yet supported in alert rule Time series queries should work in alerting conditions. Table formatted queries is not yet supported in alert rule
conditions. conditions.
## Configure datasource with provisioning ## Configure the Datasource with Provisioning
It's now possible to configure datasources using config files with Grafanas provisioning system. You can read more about how it works and all the settings you can set for datasources on the [provisioning docs page](/administration/provisioning/#datasources) It's now possible to configure datasources using config files with Grafana's provisioning system. You can read more about how it works and all the settings you can set for datasources on the [provisioning docs page](/administration/provisioning/#datasources)
Here are some provisioning examples for this datasource. Here are some provisioning examples for this datasource.
...@@ -237,5 +245,4 @@ datasources: ...@@ -237,5 +245,4 @@ datasources:
password: "Password!" password: "Password!"
jsonData: jsonData:
sslmode: "disable" # disable/require/verify-ca/verify-full sslmode: "disable" # disable/require/verify-ca/verify-full
``` ```
...@@ -38,7 +38,7 @@ documentation article for details on value escaping during interpolation. ...@@ -38,7 +38,7 @@ documentation article for details on value escaping during interpolation.
### Advanced Formatting Options ### Advanced Formatting Options
In Grafana 5.0, an additional option was added to control the formatting of the interpolation. In Grafana 5.0, a new syntax for variables was introduced to control the formatting of the interpolation.
Syntax: `${var_name:option}` Syntax: `${var_name:option}`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment