Kapacitor alert not working for threshold data in table

kapacitor
chronograf

#1

I have data flowing into a dashboard represented in a table and couple gauge charts. I tried to setup an alert for one of the values to fire if it goes above a threshold. It does not seem to fire even after testing with different values and 0 values as well.


#2

Can you show us the query that is being run?

dg


#3

Thanks for responding.

var db = ‘testDB’
var rp = ‘default’
var measurement = ‘ops_message_data’
var groupBy = []
var whereFilter = lambda: TRUE
var name = 'DASH-TEST ’
var idVar = name
var message = ‘Consumer Group:{{ index .Fields “consumer_group” }}’
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 details = ‘The consumer group lag has exceeded reasonable limit.
Consumer Group:{{ index .Fields “consumer_group” }}’
var crit = 100
var data = stream
|from()
.database(db)
.retentionPolicy(rp)
.measurement(measurement)
.groupBy(groupBy)
.where(whereFilter)
|eval(lambda: “lag”)
.as(‘value’)

var trigger = data
|alert()
.crit(lambda: “value” > crit)
.message(message)
.id(idVar)
.idTag(idTag)
.levelTag(levelTag)
.messageField(messageField)
.durationField(durationField)
.details(details)
.stateChangesOnly()
.email()
.to(‘admin@management.com’)
.to(‘support@management.com’)
trigger
|eval(lambda: float(“value”))
.as(‘value’)
.keep()
|influxDBOut()
.create()
.database(outputDB)
.retentionPolicy(outputRP)
.measurement(outputMeasurement)
.tag(‘alertName’, name)
.tag(‘triggerType’, triggerType)

That is the tickScript. The actual query is the following:

SELECT "lag" FROM "testDB"."default"."ops_message_data" WHERE time > now() - 30m AND "consumer_group"='firehose.transform' AND "messageType"='POST' GROUP BY "consumer_group"

This data is tagged to a dashboard gauge graph


#4

Please, really need help with this. Any ideas as to why this does not work.


#5

Hi ,
the output of the following may help …

the data collection interval in telegraf

select count(*) from “testDB”.“default”.ops_message_data
wait for 10 seconds and do the same statement again

kapacitor stats ingress |grep ops_message_data
wait for 10 seconds and do the same statement again

kapacitor show DASH-TEST

kapacitor record stream -task DASH-TEST -duration 60s
kapacitor list recordings

best regards ,
Marc