WIP updated monitor.from and monitor.notify functions
parent
621f137f63
commit
31e669f590
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: monitor.from() function
|
||||
description: The `monitor.from()` function ...
|
||||
description: >
|
||||
The `monitor.from()` function retrieves check statuses stored in the `_monitoring` bucket.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: monitor.from
|
||||
|
@ -8,29 +9,62 @@ menu:
|
|||
weight: 202
|
||||
---
|
||||
|
||||
The `monitor.from()` function ...
|
||||
The `monitor.from()` function retrieves check statuses stored in the `_monitoring` bucket.
|
||||
|
||||
_**Function type:** Type conversion_
|
||||
_**Function type:** Input_
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/monitor"
|
||||
|
||||
monitor.from(...)
|
||||
monitor.from(
|
||||
start: -1h,
|
||||
stop: now(),
|
||||
fn: (r) => true
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
## Parameters
|
||||
|
||||
### v
|
||||
The value to convert.
|
||||
### start
|
||||
The oldest time to include in results.
|
||||
|
||||
_**Data type:** Boolean | Duration | Float | Integer | String | Time | UInteger_
|
||||
Relative start times are defined using negative durations.
|
||||
Negative durations are relative to now.
|
||||
Absolute start times are defined using timestamps.
|
||||
|
||||
_**Data type:** Duration | Time_
|
||||
|
||||
### stop
|
||||
The newest time to include in the results.
|
||||
Defaults to `now()`.
|
||||
|
||||
Relative stop times are defined using negative durations.
|
||||
Negative durations are relative to now.
|
||||
Absolute stop times are defined using timestamps.
|
||||
|
||||
_**Data type:** Duration | Time_
|
||||
|
||||
{{% note %}}
|
||||
Flux only honors [RFC3339 timestamps](/v2.0/reference/flux/language/types#timestamp-format)
|
||||
and ignores dates and times provided in other formats.
|
||||
{{% /note %}}
|
||||
|
||||
### fn
|
||||
A single argument predicate function that evaluates `true` or `false`.
|
||||
Records or rows (`r`) that evaluate to `true` are included in output tables.
|
||||
Records that evaluate to _null_ or `false` are not included in output tables.
|
||||
|
||||
_**Data type:** Function_
|
||||
|
||||
## Examples
|
||||
|
||||
### ...
|
||||
### View critical check statuses from the last hour
|
||||
```js
|
||||
import "influxdata/influxdb/monitor"
|
||||
|
||||
monitor.from(...)
|
||||
monitor.from(
|
||||
start: -1h,
|
||||
fn: (r) => r._level == "crit"
|
||||
)
|
||||
```
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
---
|
||||
title: monitor.notify() function
|
||||
description: The `monitor.notify()` function ...
|
||||
description: >
|
||||
The `monitor.notify()` function sends a notification to an endpoint and logs it
|
||||
in the `notifications` measurement in the `_monitoring` bucket.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: monitor.notify
|
||||
|
@ -8,29 +10,43 @@ menu:
|
|||
weight: 202
|
||||
---
|
||||
|
||||
The `monitor.notify()` function ...
|
||||
The `monitor.notify()` function sends a notification to an endpoint and logs it
|
||||
in the `notifications` measurement in the `_monitoring` bucket.
|
||||
|
||||
_**Function type:** Type conversion_
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/monitor"
|
||||
|
||||
monitor.notify(...)
|
||||
monitor.notify(
|
||||
endpoint: ,
|
||||
data: {}
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
## Parameters
|
||||
|
||||
### v
|
||||
The value to convert.
|
||||
### endpoint
|
||||
A function that constructs and sends the notification to an endpoint.
|
||||
|
||||
_**Data type:** Boolean | Duration | Float | Integer | String | Time | UInteger_
|
||||
_**Data type:** Function_
|
||||
|
||||
### data
|
||||
The data object to send to the endpoint.
|
||||
Defaults to `{}`.
|
||||
|
||||
_**Data type:** Object_
|
||||
|
||||
## Examples
|
||||
|
||||
### ...
|
||||
### Send a notification to Slack
|
||||
```js
|
||||
import "influxdata/influxdb/monitor"
|
||||
import "slack"
|
||||
|
||||
monitor.notify(...)
|
||||
endpoint = slack.endpoint(name: "slack", channel: "#flux")
|
||||
|
||||
from(bucket: "system")
|
||||
|> range(start: -5m)
|
||||
|> monitor.notify(endpoint: endpoint)
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue