Skip to content

Add examples of using conditional logic in messageFn params #2009

Open
@sanderson

Description

@sanderson

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:

(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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions