Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
624dac16
Commit
624dac16
authored
Mar 21, 2018
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs: add variable regex examples (#11327)
parent
f41f2089
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
1 deletions
+68
-1
docs/sources/reference/templating.md
+68
-1
No files found.
docs/sources/reference/templating.md
View file @
624dac16
+++
title = "Variables"
keywords =
[
"grafana", "templating", "documentation", "guide"
]
keywords =
[
"grafana", "templating", "documentation", "guide"
, "template", "variable"
]
type = "docs"
[
menu.docs
]
name = "Variables"
...
...
@@ -80,6 +80,73 @@ Option | Description
*Regex*
| Regex to filter or capture specific parts of the names return by your data source query. Optional.
*Sort*
| Define sort order for options in dropdown.
**Disabled**
means that the order of options returned by your data source query will be used.
#### Using regex to filter/modify values in the Variable dropdown
Using the Regex Query Option, you filter the list of options returned by the Variable query or modify the options returned.
Examples of filtering on the following list of options:
```
text
backend_01
backend_02
backend_03
backend_04
```
##### Filter so that only the options that end with `01` or `02` are returned:
Regex:
```
regex
/.*[01|02]/
```
Result:
```
text
backend_01
backend_02
```
##### Filter and modify the options using a regex capture group to return part of the text:
Regex:
```
regex
/.*(01|02)/
```
Result:
```
text
01
02
```
#### Filter and modify - Prometheus Example
List of options:
```
text
up{instance="demo.robustperception.io:9090",job="prometheus"} 1 1521630638000
up{instance="demo.robustperception.io:9093",job="alertmanager"} 1 1521630638000
up{instance="demo.robustperception.io:9100",job="node"} 1 1521630638000
```
Regex:
```
regex
/.*instance="([^"]*).*/
```
Result:
```
text
demo.robustperception.io:9090
demo.robustperception.io:9093
demo.robustperception.io:9100
```
### Query expressions
The query expressions are different for each data source.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment