Hi,
I can’t figure out why this script is not pushing anything out. It’s enabled, and using the “show” command I can see that it is processing points, yet nothing gets triggered. Nothing on the logs either.
The objective of the script is to constantly push a status to an external system, that’s why I’m using info level when the situation is normal (rejected_connections == 0). I do not expect any OK from this script, just CRITICAL or INFO.
It’s probably a simple thing, but I think I need a second pair of eyes
Thanks in advance.
dbrp "telegraf"."autogen"
var db = 'telegraf'
var rp = 'autogen'
var measurement = 'redis'
var groupBy = ['host', 'port']
var whereFilter = lambda: TRUE
var name = 'Redis: Rejected Connections'
var idVar = name + ':{{.Group}}'
var message = 'TESTING'
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 = 0
var data = stream
|from()
.database(db)
.retentionPolicy(rp)
.measurement(measurement)
.groupBy(groupBy)
.where(whereFilter)
|eval(lambda: "rejected_connections")
.as('value')
var trigger = data
|alert()
.info(lambda: "value" == crit)
.crit(lambda: "value" > crit)
.message(message)
.id(idVar)
.idTag(idTag)
.levelTag(levelTag)
.messageField(messageField)
.durationField(durationField)
.log('/tmp/redis_rejected_connections.log')
.exec('/etc/kapacitor/exec/alert_custom.py')
trigger
|eval(lambda: float("value"))
.as('value')
.keep()
|influxDBOut()
.create()
.database(outputDB)
.retentionPolicy(outputRP)
.measurement(outputMeasurement)
.tag('alertName', name)
.tag('triggerType', triggerType)
trigger
|httpOut('output')