From Telegraf to Kapacitor, I have one measurement that sends the value of multiple alarms that i differentiate through a tag called “io_name”. Then alert ids are generated thanks to this tag.
I have this issue that whenever an alert() is triggered on one id and the other id is OK, the alert node will behave as if there was a change of state. Is it because the .stateChangeOnly() is just tied to the measurement and not the alert id ?
Here is my code, any idea of workaround ?
var id = '{{ index .Tags "io_name"}}'
var message = '{{ .Time }}: {{.Level }} alert has been triggered for {{index .Tags "io_name"}}'
stream
|from()
.database('kap_telegraf')
|alert()
.id(id)
.message(message)
.crit(lambda: "value" == 1)
.stateChangesOnly()
.log('C:/www/kapacitor/alerts.log')
.idTag('id')
.messageField('message')
.levelTag('level')
|delete()
.tag('io_name')
|where(lambda: "id" != '')
|influxDBOut()
.database('telegraf')
.retentionPolicy('autogen')
Hi bnjroos, I am trying to setup Telegraf to output to Kapacitor.
I tried using the Telegraf’s outputs.influxdb plugin and set it to the port Kapacitor API server is listening on (port 9092 by default), but it did not work.
[Telegraf’s log]
2019-04-03T06:13:48Z E! [outputs.influxdb] when writing to [[httplink]:9092]: Post [httplink]:9092/write?db=telegraf&rp=autogen: dial tcp 192.168.0.77:9092: connect: connection refused
[Kapacitor’s log]
ts=2019-04-03T14:52:29.786+08:00 lvl=error msg=“failed to connect to InfluxDB, retrying…” service=influxdb cluster=kapacitor err=“Get [httplink]:9092/ping: dial tcp 192.168.0.77:9092: connect: connection refused”