monitor.stateChanges() function
The monitor.stateChanges()
function detects state changes in a stream of data with
a _level
column and outputs records that change from fromLevel
to toLevel
.
import "influxdata/influxdb/monitor"
monitor.stateChanges(
fromLevel: "any",
toLevel: "any",
)
Parameters
fromLevel
The level to detect a change from.
Defaults to "any"
.
toLevel
The level to detect a change to.
The function output records that change to this level.
Defaults to "any"
.
tables
Input data.
Default is piped-forward data (<-
).
Examples
Detect when the state changes to critical
import "influxdata/influxdb/monitor"
monitor.from(start: -1h)
|> monitor.stateChanges(toLevel: "crit")
Example input data
_time | _level |
---|---|
2021-01-01T00:00:00Z | ok |
2021-01-01T00:10:00Z | ok |
2021-01-01T00:20:00Z | warn |
2021-01-01T00:30:00Z | crit |
Example output data
_time | _level |
---|---|
2021-01-01T00:30:00Z | crit |
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Flux and this documentation. To find support, the following resources are available:
InfluxDB Cloud customers can contact InfluxData Support.