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
00a676ff
Unverified
Commit
00a676ff
authored
Feb 07, 2019
by
Torkel Ödegaard
Committed by
GitHub
Feb 07, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15292 from mtanda/template_json_format
support json format templating
parents
8c65430e
89d69a6f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
0 deletions
+14
-0
docs/sources/features/datasources/cloudwatch.md
+10
-0
docs/sources/reference/templating.md
+1
-0
public/app/features/templating/template_srv.ts
+3
-0
No files found.
docs/sources/features/datasources/cloudwatch.md
View file @
00a676ff
...
...
@@ -214,6 +214,16 @@ Example `ec2_instance_attribute()` query
ec2_instance_attribute
(
us
-
east
-
1
,
Tags
.
Name
,
{
"tag:Team"
:
[
"sysops"
]
})
```
## Using json format template variables
Some of query takes JSON format filter. Grafana support to interpolate template variable to JSON format string, it can use as filter string.
If
`env = 'production', 'staging'`
, following query will return ARNs of EC2 instances which
`Environment`
tag is
`production`
or
`staging`
.
```
resource_arns(us-east-1, ec2:instance, {"Environment":${env:json}})
```
## Cost
Amazon provides 1 million CloudWatch API requests each month at no additional charge. Past this,
...
...
docs/sources/reference/templating.md
View file @
00a676ff
...
...
@@ -50,6 +50,7 @@ Filter Option | Example | Raw | Interpolated | Description
`regex`
| ${servers:regex} |
`'test.', 'test2'`
|
<code>
(test
\.
|
test2)
</code>
| Formats multi-value variable into a regex string
`pipe`
| ${servers:pipe} |
`'test.', 'test2'`
|
<code>
test.
|
test2
</code>
| Formats multi-value variable into a pipe-separated string
`csv`
| ${servers:csv} |
`'test1', 'test2'`
|
`test1,test2`
| Formats multi-value variable as a comma-separated string
`json`
| ${servers:json} |
`'test1', 'test2'`
|
`["test1","test2"]`
| Formats multi-value variable as a JSON string
`distributed`
| ${servers:distributed} |
`'test1', 'test2'`
|
`test1,servers=test2`
| Formats multi-value variable in custom format for OpenTSDB.
`lucene`
| ${servers:lucene} |
`'test', 'test2'`
|
`("test" OR "test2")`
| Formats multi-value variable as a lucene expression.
`percentencode`
| ${servers:percentencode} |
`'foo()bar BAZ', 'test2'`
|
`{foo%28%29bar%20BAZ%2Ctest2}`
| Formats multi-value variable into a glob, percent-encoded.
...
...
public/app/features/templating/template_srv.ts
View file @
00a676ff
...
...
@@ -156,6 +156,9 @@ export class TemplateSrv {
}
return
value
;
}
case
'json'
:
{
return
JSON
.
stringify
(
value
);
}
case
'percentencode'
:
{
// like glob, but url escaped
if
(
_
.
isArray
(
value
))
{
...
...
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