The prepared image works fine. For some use cases it may be good to downsample the data.
E.g. after one year with 5 ruuvitags I got problems with the amount of data in the database.
Because I have to search a little bit to get it working, here is an example how to set up downsampling.
In this example the original data will be stored for 7 days, and deleted after this time.
For long term storage 30 minutes mean values of some measurements will be stored.
Step by Step:
Connect to raspberry shell and type influx to start the influx db command line interface.
Switch to ruuvi database
> use ruuvi
Change the duration of the default retention policy to e.g. 7 days. So that after 7 days the detailed data will be deleted.
> ALTER RETENTION POLICY autogen ON ruuvi DURATION 7d
Create a new retention policy for the long term data
> CREATE RETENTION POLICY "forever" ON "ruuvi" DURATION INF REPLICATION 1
Check the results
> SHOW RETENTION POLICIES
name duration shardGroupDuration replicaN default
---- -------- ------------------ -------- -------
autogen 168h0m0s 168h0m0s 1 true
forever 0s 168h0m0s 1 false
Create a continuous query for the data that you would like to store long term.
In this example the mean values of 30 minutes intervalls will be stored for temperature, humidity, pressure and battery voltage
> CREATE CONTINUOUS QUERY cq_30m ON ruuvi BEGIN
SELECT mean(temperature) as “mean_temperature”, mean(humidity) as “mean_humidity”,
mean(pressure) as “mean_pressure”, mean(batteryVoltage) as "mean_batteryVoltage"
FROM ruuvi.autogen.ruuvi_measurements GROUP BY time(30m), mac FILL(null) END