Reputation: 183
I would like to store the message of an alert in influxDB using influxDBOut. Is is possible?
Here is my tick script
batch
|query('SELECT mean(value) as value FROM "metrics"."autogen"."__MEASUREMENT__"')
.period(15m)
.every(5s)
.groupBy(*)
.fill(0)
|alert()
.id('[METRICS] - {{ .Name }}')
.message('{{ .ID }} changed state to {{ .Level}} [{{ .Time }}] => The metric {{ index .Fields "value" }} in the last 15m.')
.info(lambda: TRUE)
.warn(lambda: "value" < __WARN_THRESHOLD__)
.crit(lambda: "value" < __CRIT_THRESHOLD__)
.stateChangesOnly()
.levelField('Severity')
|influxDBOut()
.database('alerts')
.retentionPolicy('autogen')
.measurement('__MEASUREMENT__')
.tag('Condition', 'Low')
Upvotes: 0
Views: 450
Reputation: 19288
Q: I would like to store the message of an alert in influxDB using influxDBOut. Is is possible?
A: Michael definitely knows waayyy better than I do. Yes, there is no straight forward way out at the moment. However it doesn't mean that this is not do-able.
What you're trying to do here is a typical software dev problem.
You can handle this sort of problem in any scripting language that supports the highlighted points above. The only tricky thing is probably #4 as not every scripting language has a influxdb
database driver, but still you can do curl
commands to perform the writes.
What you could do is
log()
of alert
node.log()
functionality.Parse the file
format the data so that they can be inserted into a measurement
cron
to periodically run your script.Hope it helps.
Upvotes: 0
Reputation: 4747
Unfortunately there currently isn't a way to achieve a result like this. If this functionality is particularly important to you, I'd recommend opening up a feature request on Kapacitor detailing your use case.
Upvotes: 0