influxdata / influxdata/docs-v2
Add examples of using conditional logic in messageFn params
- Dominant language
- JavaScript
- Stars
- 82
- Forks
- 326
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 82
Description
A community user is trying to conditionally set a message based off values in the row. This is for the `messageFn` parameter of `monitor.check()`. We need to show the syntax for that conditional logic:
```js
(r) => {
message = (
if r._level == "crit" then "Critical alert!! Disk usage for ${r.path} on ${r.host} is at ${string(v: r._value)}%!"
else "Things are looking good."
)
return message
}
```
##### Relevant URLs
- https://docs.influxdata.com/influxdb/v2.0/reference/flux/stdlib/monitor/check/
- https://docs.influxdata.com/influxdb/cloud/reference/flux/stdlib/monitor/check/
- https://docs.influxdata.com/influxdb/v2.0/monitor-alert/custom-checks/
- https://docs.influxdata.com/influxdb/cloud/monitor-alert/custom-checks/
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.