Merge pull request #115 from influxdata/variable-updates

Updates to variables docs
pull/116/head
Scott Anderson 2019-03-29 13:08:20 -06:00 committed by GitHub
commit 79238a541f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 77 additions and 19 deletions

View File

@ -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.

View File

@ -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"
)
```

View File

@ -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