influxdata / influxdata/kapacitor
Relative Alert builder works properly?
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
I'm trying to configure some alerts to check if my ICK v1.5 (InfluxDB+Chronograf+Kapacitor) works properly. When I try to configure Threshold or deadman alerts, I have no problems and they create an alert when they should do.
But I need to compare if there are any changes in different time instances, so I need to use relative alerts. Is alert builder working properly? It creates somthing like this:
var db = 'bsmetrics'
var rp = 'autogen'
var measurement = 'dentdeserra'
var groupBy = []
var whereFilter = lambda: TRUE
var name = 'Borrable'
var idVar = name
var message = ' {{.ID}} {{.Name}} is KO'
var idTag = 'alertID'
var levelTag = 'level'
var messageField = 'message'
var durationField = 'duration'
var outputDB = 'chronograf'
var outputRP = 'autogen'
var outputMeasurement = 'alerts'
var triggerType = 'relative'
var shift = 10m
var crit = 1
var data = stream
|from()
.database(db)
.retentionPolicy(rp)
.measurement(measurement)
.groupBy(groupBy)
.where(whereFilter)
|eval(lambda: "valor")
.as('value')
var past = data
|shift(shift)
var current = data
var trigger = past
|join(current)
.as('past', 'current')
|eval(lambda: float("current.value" - "past.value"))
.keep()
.as('value')
|alert()
.crit(lambda: "value" > crit)
.stateChangesOnly()
.message(message)
.id(idVar)
.idTag(idTag)
.levelTag(levelTag)
.messageField(messageField)
.durationField(durationField)
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')
Analyzing the code generated, I'm not able to see what is wrong.
Where can I find a template or something similar to build that type of alerts?
edit: Related to #1972
Contributor guide
Research direction
Start by reproducing the relative alert configuration from the generated TICKscript in the issue and compare its behavior with the working threshold and deadman alerts. Review the related discussion in #1972 and determine whether the alert builder output is incorrect or whether the configuration needs a documented template; done means identifying the cause and documenting or confirming the expected relative-alert behavior.
Written by the indexing model from the issue text.
Assessment
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100