From cb6c67f18f2e2c3bd85c6371b28b841e43cfc3a4 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Fri, 29 Mar 2019 11:44:26 -0600 Subject: [PATCH] updated typos and wording in variable docs, added more query examples --- .../v2.0/visualize-data/variables/_index.md | 10 +-- .../variables/common-variables.md | 81 ++++++++++++++++--- .../variables/variable-types.md | 5 +- 3 files changed, 77 insertions(+), 19 deletions(-) diff --git a/content/v2.0/visualize-data/variables/_index.md b/content/v2.0/visualize-data/variables/_index.md index 64659aaed..b64f6604e 100644 --- a/content/v2.0/visualize-data/variables/_index.md +++ b/content/v2.0/visualize-data/variables/_index.md @@ -11,13 +11,13 @@ weight: 101 "v2.0/tags": [variables] --- -Dashboard variables allow you to alter specific components of cells' queries -without having to edit the queries, making it easy to interact with your dashboard cells and explore your data. +Dashboard variables let you alter specific components of cells' queries without having to edit the queries, +making it easy to interact with your dashboard cells and explore your data. Variables are scoped by organization. ## Use dashboard variables -Both [custom dashboard variables](#manage-custom-variables) and [predefined dashboard variables](#predefined-dashboard-variables) +Both [predefined dashboard variables](#predefined-dashboard-variables) and [custom dashboard variables](#manage-custom-variables) are stored in a `v` object associated with each dashboard. Reference each variable using dot-notation (e.g. `v.variableName`). @@ -36,7 +36,7 @@ in the **Variables** tab next to the Functions tab. Click on a variable name to add it to your query and select a value from the **Value** dropdown. ## Predefined dashboard variables -The InfluxDB provides the following predefined dashboard variables: +The InfluxDB user interface (UI) provides the following predefined dashboard variables: #### v.timeRangeStart Specifies the beginning of the queried time range. @@ -55,7 +55,7 @@ It defaults to `now`. #### v.windowPeriod Specifies the period of windowed data. -This variable is typically used to define the `every` or `period` parameter of the +This variable is typically used to define the `every` or `period` parameters of the [`window()` function](/v2.0/reference/flux/functions/built-in/transformations/window) in data aggregation operations. diff --git a/content/v2.0/visualize-data/variables/common-variables.md b/content/v2.0/visualize-data/variables/common-variables.md index f733ed747..2f8312f92 100644 --- a/content/v2.0/visualize-data/variables/common-variables.md +++ b/content/v2.0/visualize-data/variables/common-variables.md @@ -9,33 +9,37 @@ weight: 208 "v2.0/tags": [variables] --- -### List buckets +## List buckets List all buckets in the current organization. + +_**Flux functions:** +[buckets()](/v2.0/reference/flux/functions/built-in/inputs/buckets/), +[rename()](/v2.0/reference/flux/functions/built-in/transformations/rename/), +[keep()](/v2.0/reference/flux/functions/built-in/transformations/keep/)_ + ```js buckets() |> rename(columns: {"name": "_value"}) |> keep(columns: ["_value"]) ``` -### List measurements +## List measurements List all measurements in a specified bucket. +_**Flux package:** [InfluxDB v1](/v2.0/reference/flux/functions/influxdb-v1/) +**Flux functions:** [v1.measurements()](/v2.0/reference/flux/functions/influxdb-v1/measurements/)_ + ```js import "influxdata/influxdb/v1" v1.measurements(bucket: "bucket-name") ``` -### List hosts -List all `host` tag values in a specified bucket. - -```js -import "influxdata/influxdb/v1" -v1.tagValues(bucket: "bucket-name", tag: "host") -``` - -### List fields in a measurement +## List fields in a measurement List all fields in a specified bucket and measurement. +_**Flux package:** [InfluxDB v1](/v2.0/reference/flux/functions/influxdb-v1/) +**Flux functions:** [v1.measurementTagValues()](/v2.0/reference/flux/functions/influxdb-v1/measurementtagvalues/)_ + ```js import "influxdata/influxdb/v1" v1.measurementTagValues( @@ -44,3 +48,58 @@ v1.measurementTagValues( tag: "_field" ) ``` + +## List hosts +List all `host` tag values in a specified bucket. + +_**Flux package:** [InfluxDB v1](/v2.0/reference/flux/functions/influxdb-v1/)_ +_**Flux functions:** [v1.measurements()](/v2.0/reference/flux/functions/influxdb-v1/measurements/)_ + +```js +import "influxdata/influxdb/v1" +v1.tagValues(bucket: "bucket-name", tag: "host") +``` + +## List Docker containers +List all Docker containers when using the Docker Telegraf plugin. + +_**Telegraf plugin:** [Docker](https://docs.influxdata.com/telegraf/latest/plugins/inputs/#docker)_ +_**Flux package:** [InfluxDB v1](/v2.0/reference/flux/functions/influxdb-v1/)_ +_**Flux functions:** [v1.tagValues()](/v2.0/reference/flux/functions/influxdb-v1/tagvalues/)_ + +```js +import "influxdata/influxdb/v1" +v1.tagValues(bucket: "bucket-name", tag: "container_name") +``` + +## List Kubernetes pods +List all Kubernetes pods when using the Kubernetes Telegraf plugin. + +_**Telegraf plugin:** [Kubernetes](https://docs.influxdata.com/telegraf/latest/plugins/inputs/#kubernetes)_ +_**Flux package:** [InfluxDB v1](/v2.0/reference/flux/functions/influxdb-v1/)_ +_**Flux functions:** [v1.measurementTagValues()](/v2.0/reference/flux/functions/influxdb-v1/measurementtagvalues/)_ + +```js +import "influxdata/influxdb/v1" +v1.measurementTagValues( + bucket: "bucket-name", + measurement: "kubernetes_pod_container", + tag: "pod_name" +) +``` + +## List Kubernetes nodes +List all Kubernetes nodes when using the Kubernetes Telegraf plugin. + +_**Telegraf plugin:** [Kubernetes](https://docs.influxdata.com/telegraf/latest/plugins/inputs/#kubernetes)_ +_**Flux package:** [InfluxDB v1](/v2.0/reference/flux/functions/influxdb-v1/)_ +_**Flux functions:** [v1.measurementTagValues()](/v2.0/reference/flux/functions/influxdb-v1/measurementtagvalues/)_ + +```js +import "influxdata/influxdb/v1" +v1.measurementTagValues( + bucket: "bucket-name", + measurement: "kubernetes_node", + tag: "node_name" +) +``` diff --git a/content/v2.0/visualize-data/variables/variable-types.md b/content/v2.0/visualize-data/variables/variable-types.md index a7bbcb117..5e85b27d9 100644 --- a/content/v2.0/visualize-data/variables/variable-types.md +++ b/content/v2.0/visualize-data/variables/variable-types.md @@ -13,11 +13,10 @@ weight: 207 In the current version of InfluxDB v2.0 alpha, only [query-populated variables](#query) are available. {{% /note %}} -Variable types determine how the list of possible values is populated. +Variable types determine how a variable's list of possible values is populated. ## Query -Variable values are populated using the results of a Flux query. -All values in the `_value` column are possible values for the variable. +Variable values are populated using the `_value` column of a Flux query. ##### Variable query example ```js