InfluxDB Docs

monitor.stateChanges() function

The features and functionality discussed on this page are unique to InfluxDB Cloud 2.0.

The monitor.stateChanges() function detects state changes in a stream of data and outputs records that change from fromLevel to toLevel.

monitor.stateChanges operates on data in the statuses measurement and requires a _level column .

Function type: Transformation

import "influxdata/influxdb/monitor"

monitor.stateChanges(
  fromLevel: "any",
  toLevel: "crit"
)

Parameters

fromLevel

The level to detect a change from. Defaults to "any".

Data type: String

toLevel

The level to detect a change to. The function output records that change to this level.

Data type: String

Examples

Detect when the state changes to critical

import "influxdata/influxdb/monitor"

monitor.from(start: -1h)
  |> monitor.stateChanges(toLevel: "crit")