[Solved]Template definition with Chronograf triggers - has string undefined errors


Trying to create templates that leverage chronograf too, but I keep getting ‘invalid TICKscript: name “string” is undefined. Names in scope: stream,time’ It would be helpful to know the line it is objecting to not being defined, though it is my understanding the actual task will define strings.

Here is tickscript:

var measurement = string
var groups = [*]
var metric = string
var whereFilter = lambda: TRUE
var message = string
var durationField = ‘duration’
var alertName = string
var idVar = alertName + ‘:{{.Group}}’
var outputDB = ‘chronograf’
var outputRP = ‘autogen’
var outputMeasurement = ‘alerts’
var triggerType = ‘custom’
var alertURL = string
var periodTime = duration
var checkTime = duration
var warnSig = float
var critSig = float
var data = stream
var trigger = data
|eval(lambda: sigma(“stat”))
.warn(lambda: “sigma” > warnSig)
.crit(lambda: “sigma” > critSig)
.levelTag(’{{ .Level }}’)
|eval(lambda: “sigma”)
.tag(‘alertName’, alertName)
.tag(‘triggerType’, triggerType)


Ok, figured out my issue - it is because I’m assigning variable string instead of setting it:

var measurement = string (incorrect)
var measurement string (correct)

Also, groupBy should be groups
var messageField = ‘message’ (correction)

I could use a better explanation to what ‘idField’,‘messageField’,‘durationField’, ‘idTag’ alertNode properties are really used for- the description in docs isnt so clear to the new user of said properties.