docs-v2/content/flux/v0.x/stdlib/influxdata/influxdb/monitor/statechangesonly.md

1.5 KiB

title description aliases menu weight flux/v0.x/tags introduced
monitor.stateChangesOnly() function The `monitor.stateChangesOnly()` function takes a stream of tables that contains a `_level` column and returns a stream of tables where each record represents a state change.
/influxdb/v2.0/reference/flux/stdlib/monitor/statechangesonly/
/influxdb/cloud/reference/flux/stdlib/monitor/statechangesonly/
/cloud/reference/flux/stdlib/monitor/statechangesonly/
flux_0_x_ref
name parent
monitor.stateChangesOnly monitor
202
transformations
0.65.0

The monitor.stateChangesOnly() function takes a stream of tables that contains a _level column and returns a stream of tables where each record represents a state change.

import "influxdata/influxdb/monitor"

monitor.stateChangesOnly()

Parameters

tables

Input data. Default is piped-forward data (<-).

Examples

Return records representing state changes
import "influxdata/influxdb/monitor"

monitor.from(start: -1h)
    |> monitor.stateChangesOnly()

{{< flex >}} {{% flex-content %}}

Example input data
_time _level
0001 ok
0002 ok
0003 warn
0004 crit
{{% /flex-content %}}
{{% flex-content %}}
Example output data
_time _level
0002 ok
0003 warn
0004 crit
{{% /flex-content %}}
{{< /flex >}}