influxdata / influxdata/kapacitor

Referencing node properties

Open
#1,993 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.4k
Forks
479
Avg merge
4d 16h
Merged PRs (30d)
4

Description

This is probably not a bug as much as a matter of documentation: It is unclear (at least to me) how to reference, say, the message in an alert-node.

Let's say I want to HTTP post a message with a particular body to a server using `exec` and curl; then I'd like to be able to reference the`.message` field in the `alert_critical` node from the arguments I pass to curl in `.exec`. That's indicated by the `???` in the script below.

Any clues on how to do this would be appreciated. Thanks.

```tick
dbrp "test"."autogen"

var data = batch
|query('''SELECT max("value") AS value FROM "test"."autogen"."foo"''')
.period(15s)
.every(3s)

var alert_critical = data
|alert()
.crit(lambda: "value" > 2 )
.message('Value is now: {{ index .Fields "value" }}. Do something!')
.stateChangesOnly()

alert_critical
.exec('/usr/bin/curl', 'http://someserver.com', '-d', 'message=???')
```

Contributor guide

Open the contributing guide

Research direction

Start with the Kapacitor documentation for the alert() and exec() nodes and the TICKscript example in this issue. Determine how a node's message field can be referenced when constructing exec arguments, then document the syntax with a working version of the shown curl example.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.