Reputation: 131
Folks, I am storing for 7 days temperature messuremnts I do get get via MQTT via the Telegraf into a messurement on my RapsberyyPI InfluxDB. what I do see when I visualize my Temperature that I do get Temperature values in between -200 and +200 which seems to be random. So most of the time I do get the right value. Just wonder if there is a way to tell telegraf only accept values in beween -30 and +40 so I can filter these values before I insert them into my Influx DB. Any ideas? The source of the data is c omming from aRTL_433 sniffer running on my Rapsi and sending whatever it got as JSON. Looks like that data is not always as accurate as I do need it.
Upvotes: 1
Views: 584
Reputation: 166
use kapacitor to resolve this.
first create a database with short retention policy to store raw data. second step, create tick DSL script to get what you want and then write it back to a new database like
batch
|query('''
...
''')
.period(5m)
.every(5m)
.groupBy(time(1m))
|influxDBOut()
.database('some_database')
.retentionPolicy('autogen')
.measurement('some_measurement')
Upvotes: 1
Reputation: 36
You could try creating a continuous query that only accepts values in your range. To do this you'd need to have two measurements in your database, I'm going to call them raw_temp and temp. Maybe something like:
CREATE CONTINUOUS QUERY "temp_filter" ON "my_db"
RESAMPLE EVERY 30s FOR 30s
BEGIN
SELECT "temperature" INTO "temp" from "raw_temp" where "temperature" > -40 and
"temperature" < 40 GROUP BY *
END
And then create a continuous query that deletes anything in raw_temp that is older than an hour. Or you could install Kapacitor which makes it pretty easy to do data manipulation.
Upvotes: 2