I want to make sure kapacitor processes only unique data point by setting up a flag after processing. I want to do something like this:
dbrp "TEST_MEASUREMENTS"."autogen"
batch
|query('''
SELECT mean(data)
FROM "TEST_MEASUREMENTS"."autogen"."temperature"
WHERE "processed" != 'true'
''')
.period(1h)
.every(15m)
|alert()
.crit(lambda: "mean" > 30)
.post('http://localhost/api/post-alerts')
|InfluxDBOut()
.database('TEST_MEASUREMENTS')
.retentionPolicy('autogen')
.measurement('temperature')
.tag('processed','true')
I can ditch where for the node |changeDetect('processed')
. Apparently my script does not work because it writes new data point to my table instead of updating the old ones with processed true. How can I achieve this with kapacitor?
Additionally for some reason doing “processed” == ‘false’ does not trigger the alert.