Still trying to get my head round Kapacitor syntax…
I have created a template TICK script. A snippet of it is below. My GroupBy clause is on a Tag called DeviceId i.e. [‘DeviceId’]
I want to push the DeviceId into another Measurement using InfluxDBOut. It works but I can’t get the DeviceId when defining the Tag on the InfluxDBOut node. In this part of the script…
.tag(‘DeviceId’, ‘NeedTheDeviceIdHere’)
TICK script:
var data = stream
|from()
.database(db).retentionPolicy(rp).measurement(measurement)
.groupBy(groupBy)
.where(whereFilter)
var trigger = data
|alert()
.crit(lambda: “Value” == ‘true’).stateChangesOnly().message(message)
.id(idVar).idTag(idTag).levelTag(levelTag).messageField(messageField).durationField(durationField)
.slack().channel(‘alerts-UIEvents’)
trigger
|influxDBOut()
.create().database(outputDB).retentionPolicy(outputRP).measurement(outputMeasurement)
.tag(‘DeviceId’, ‘NeedTheDeviceIdHere’).tag(‘Severity’, ‘Information’)