forked from ResEnv/chain-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
backfill.sh
4 lines (4 loc) · 995 Bytes
/
backfill.sh
1
2
3
4
#!/bin/bash
curl -i -XPOST 'http://localhost:8086/query?pretty=true' --data-urlencode "db=chain" --data-urlencode "q=SELECT max(\"value\"), min(\"value\"), mean(\"value\"), count(\"value\"), sum(\"value\") INTO \"sensordata_1h\" FROM \"sensor_data\" WHERE \"time\" < '2017-05-10' GROUP BY \"sensor_id\", time(1h), *"
curl -i -XPOST 'http://localhost:8086/query?pretty=true' --data-urlencode "db=chain" --data-urlencode "q=SELECT max(\"max\"), min(\"min\"), sum(\"sum\")/sum(\"count\") as \"mean\", sum(\"count\") as \"count\", sum(\"sum\") INTO \"sensordata_1d\" FROM \"sensordata_1h\" WHERE \"time\" < '2017-05-10' GROUP BY \"sensor_id\", time(1d), *"
curl -i -XPOST 'http://localhost:8086/query?pretty=true' --data-urlencode "db=chain" --data-urlencode "q= SELECT max(\"max\"), min(\"min\"), sum(\"sum\")/sum(\"count\") as \"mean\", sum(\"count\") as \"count\", sum(\"sum\") INTO \"sensordata_1w\" FROM \"sensordata_1d\" WHERE \"time\" < '2017-05-10' GROUP BY \"sensor_id\", time(1w), *"