I collect network counter every 1 minute then testing kapacitor to alert with simple threshold but it not working and show log like this.
"E! failed to aggregate batch: field packets_sent missing from point cannot aggregate"
this is my TICKscript:
var db = 'telegraf'
var rp = 'autogen'
var measurement = 'net'
var groupBy = ['host']
var whereFilter = lambda: ("host" == 'FW-GW1')
var period = 1m
var every = 30s
var name = 'FW NET'
var idVar = name + ':{{.Group}}'
var message = '{{.Name}} {{.Level}} for {{ index .Tags "host" }}'
var idTag = 'alertID'
var levelTag = 'level'
var messageField = 'message'
var durationField = 'duration'
var outputDB = 'chronograf'
var outputRP = 'autogen'
var outputMeasurement = 'alerts'
var triggerType = 'threshold'
var crit = 800
var data = stream
|from()
.database(db)
.retentionPolicy(rp)
.measurement(measurement)
.groupBy(groupBy)
.where(whereFilter)
|window()
.period(period)
.every(every)
.align()
|mean('packets_sent')
.as('value')
var trigger = data
|alert()
.crit(lambda: "value" > crit)
.stateChangesOnly()
.message(message)
.id(idVar)
.idTag(idTag)
.levelTag(levelTag)
.messageField(messageField)
.durationField(durationField)
.slack()
I collect network counter every 1 minute then testing kapacitor to alert with simple threshold but it not working and show log like this. "E! failed to aggregate batch: field packets_sent missing from point cannot aggregate" this is my TICKscript: var db = 'telegraf' var rp = 'autogen' var measurement = 'net' var groupBy = ['host'] var whereFilter = lambda: ("host" == 'FW-GW1') var period = 1m var every = 30s var name = 'FW NET' var idVar = name + ':{{.Group}}' var message = '{{.Name}} {{.Level}} for {{ index .Tags "host" }}' var idTag = 'alertID' var levelTag = 'level' var messageField = 'message' var durationField = 'duration' var outputDB = 'chronograf' var outputRP = 'autogen' var outputMeasurement = 'alerts' var triggerType = 'threshold' var crit = 800 var data = stream |from() .database(db) .retentionPolicy(rp) .measurement(measurement) .groupBy(groupBy) .where(whereFilter) |window() .period(period) .every(every) .align() |mean('packets_sent') .as('value')
var trigger = data |alert() .crit(lambda: "value" > crit) .stateChangesOnly() .message(message) .id(idVar) .idTag(idTag) .levelTag(levelTag) .messageField(messageField) .durationField(durationField) .slack()
trigger |influxDBOut() .create() .database(outputDB) .retentionPolicy(outputRP) .measurement(outputMeasurement) .tag('alertName', name) .tag('triggerType', triggerType)
trigger |httpOut('output')