Kapacitor TICKscript Error - "group-nil" Issue

Hello community,

I hope you’re all doing well. I’m currently working on setting up Kapacitor to process and analyze data from InfluxDB using TICKscripts. However, I’ve encountered an issue with my TICKscript that I could use some assistance with.

Issue: I am consistently getting a “group-nil” error when running my TICKscript. This error is preventing me from processing the data as expected.

TICKscript (Snippet 2):
var db = ‘Jubail III A_OPC’

var rp = ‘autogen’

var measurement = ‘Jubail 3A’

var groupBy = [‘Asset/Eqpt Name’, ‘Block Name’, ‘Plant Name’, ‘Section Name’, ‘Tag Name’]

var whereFilter = lambda: TRUE

var period = 2m

var name = ‘Group’

var idVar = name + ‘-{{.Group}}’

var message = ‘is {{ if eq .Level “OK” }}Alive{{ else }}Dead{{ end }}’

var idTag = ‘alertID’

var levelTag = ‘level’

var messageField = ‘message’

var durationField = ‘duration’

var outputMeasurement = ‘opc’

var triggerType = ‘deadman’

var threshold = 0.0

var data = stream
|from()
.database(db)
.retentionPolicy(rp)
.measurement(measurement)
.groupBy(groupBy)
.where(whereFilter)
|log()

var trigger = data
|deadman(threshold, period)
.message(message)
.id(idVar)
.idTag(idTag)
.levelTag(levelTag)
.messageField(messageField)
.durationField(durationField)

trigger
|eval(lambda: “emitted”)
.as(‘value’)
.keep(‘value’, messageField, durationField)
|eval(lambda: float(“value”))
.as(‘value’)
.keep()
|influxDBOut()
.cluster(‘host’)
.create()
.database(‘Jubail 3A_ALERTS’)
.retentionPolicy(‘autogen’)
.measurement(outputMeasurement)
.tag(‘alertName’, name)
.tag(‘triggerType’, triggerType)

trigger
|httpOut(‘output’)

Error Message:

group-nil error: [...]

Details: I’ve carefully reviewed my TICKscript and the data source (InfluxDB). The TICKscript is designed to group data by certain fields (Asset/Eqpt Name, Block Name, Plant Name, Section Name, Tag Name) and apply further processing. However, despite specifying the correct fields in the groupBy clause, I keep encountering the “group-nil” error.

What I’ve Checked:

  • Field names in groupBy clause match the data.
  • Data quality and consistency.
  • Logging data to troubleshoot.
  • Testing with a subset of data.

I’m reaching out to the community for guidance on how to resolve this issue. Has anyone encountered a similar problem with Kapacitor TICKscripts? Are there any insights or suggestions you can provide to help me pinpoint and fix the problem?

Your expertise and assistance would be greatly appreciated. Thank you in advance for your help!

Best regards,
Naveen Kumar R

Hello @naveen_kumar,
Unfortunately, the InfluxDB team doesn’t offer support on Kapacitor anymore. I hope someone from the community can help. But I might also recommend searching for kapacitor questions and users who work on kapacitor and asking them questions.

I’d recommend using a client library and a FaaS or cron job to execute this processing.