Skip to main content

Dashboards Setup

Variables

Get the value from a tag

> show tag values from "snapdb" with key="db"

Get the value from a field

> select DISTINCT("vmname") from (select "ready_summation","vmname" from "vsphere_vm_cpu")

Query Syntax

InfluxDB v2 with InfluxQL

vSphere Cluster CPU Usage

from(bucket: v.defaultBucket)
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "vsphere_host_cpu")
  |> filter(fn: (r) => r["_field"] == "usage_average")
  |> filter(fn: (r) => r["cpu"] == "instance-total")
  |> filter(fn: (r) => r["clustername"] =~ /${clustername:regex}/)
  |> group(columns: ["clustername"])
  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
  |> yield(name: "mean")