From 89d69a6f21e06e68fb35659446f4b6c149f11f49 Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Thu, 7 Feb 2019 20:16:20 +0900 Subject: [PATCH] update docs --- docs/sources/features/datasources/cloudwatch.md | 10 ++++++++++ docs/sources/reference/templating.md | 1 + 2 files changed, 11 insertions(+) diff --git a/docs/sources/features/datasources/cloudwatch.md b/docs/sources/features/datasources/cloudwatch.md index 783b17874e0..6ca10b2f8e8 100644 --- a/docs/sources/features/datasources/cloudwatch.md +++ b/docs/sources/features/datasources/cloudwatch.md @@ -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, diff --git a/docs/sources/reference/templating.md b/docs/sources/reference/templating.md index 7426877654b..bf3fbd6a229 100644 --- a/docs/sources/reference/templating.md +++ b/docs/sources/reference/templating.md @@ -50,6 +50,7 @@ Filter Option | Example | Raw | Interpolated | Description `regex` | ${servers:regex} | `'test.', 'test2'` | (test\.|test2) | Formats multi-value variable into a regex string `pipe` | ${servers:pipe} | `'test.', 'test2'` | test.|test2 | 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.