Hello,
when using tags from the sideload() function, the field “value” is changed, but I don’t see why.
Without sideloaded fields like “disk_used_crit”, “value” is the actual disk usage, but when i) sideload finds host data in a .yml file or ii) the alert() function accesses the field “disk_used_crit”, then the field “value” is changed to e.g. 95.
Even stranger, also other fields like “used_percent” are at 95 now, but I cannot see why it is overwritten.
var message = 'Service {{ index .Tags "host" }}/{{.Name}} is {{.Level}}
{{ index .Tags "path" }} is at {{ index .Fields "value" }}'
[...]
var data = stream
|from()
.measurement(measurement)
.groupBy(groupBy)
.where(whereFilter)
|eval(lambda: "used_percent")
.as('value')
|sideload()
.source('file:/etc/kapacitor/sideload')
.order('{{.host}}.yml')
.field('disk_used_info', 80.0)
.field('disk_used_warn', 90.0)
.field('disk_used_crit', 95.0)
var trigger = data
|alert()
.info(lambda: "value" > "disk_used_info")
.warn(lambda: "value" > "disk_used_warn")
.crit(lambda: "value" > "disk_used_crit")
.stateChangesOnly(1h)
.id(idVar)
.idTag(idTag)
.levelTag(levelTag)
.message(message)
.messageField(messageField)
.durationField(durationField)
When I revert to static value like this, I see the corret value:
.info(lambda: "value" > 80)
.warn(lambda: "value" > 90)
.crit(lambda: "value" > 95)
Unless a .yml file for the host exists.
Any ideas?
Greetings
Benjamin