Common variable queries

List buckets

List all buckets in the current organization.

Flux functions: buckets(), rename(), keep()

  1. buckets()
  2. |> rename(columns: {"name": "_value"})
  3. |> keep(columns: ["_value"])

List measurements

List all measurements in a specified bucket.

Flux package: InfluxDB schema
Flux functions: schema.measurements()

  1. import "influxdata/influxdb/schema"
  2. schema.measurements(bucket: "bucket-name")

List fields in a measurement

List all fields in a specified bucket and measurement.

Flux package: InfluxDB schema
Flux functions: schema.measurementTagValues()

  1. import "influxdata/influxdb/schema"
  2. schema.measurementTagValues(
  3. bucket: "bucket-name",
  4. measurement: "measurement-name",
  5. tag: "_field",
  6. )

List unique tag values

List all unique tag values for a specific tag in a specified bucket. The example below lists all unique values of the host tag.

Flux package: InfluxDB schema
Flux functions: schema.tagValues()

  1. import "influxdata/influxdb/schema"
  2. schema.tagValues(bucket: "bucket-name", tag: "host")

List Docker containers

List all Docker containers when using the Docker Telegraf plugin.

Telegraf plugin: Docker
Flux package: InfluxDB schema
Flux functions: schema.tagValues()

  1. import "influxdata/influxdb/schema"
  2. schema.tagValues(bucket: "bucket-name", tag: "container_name")

List Kubernetes pods

List all Kubernetes pods when using the Kubernetes Telegraf plugin.

Telegraf plugin: Kubernetes
Flux package: InfluxDB schema
Flux functions: schema.measurementTagValues()

  1. import "influxdata/influxdb/schema"
  2. schema.measurementTagValues(
  3. bucket: "bucket-name",
  4. measurement: "kubernetes_pod_container",
  5. tag: "pod_name",
  6. )

List Kubernetes nodes

List all Kubernetes nodes when using the Kubernetes Telegraf plugin.

Telegraf plugin: Kubernetes
Flux package: InfluxDB schema
Flux functions: schema.measurementTagValues()

  1. import "influxdata/influxdb/schema"
  2. schema.measurementTagValues(
  3. bucket: "bucket-name",
  4. measurement: "kubernetes_node",
  5. tag: "node_name",
  6. )

variables