Last active
April 28, 2016 07:48
-
-
Save lauriku/29ec28f394f83c61f2a8f9fe5a48d4bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HTTP API via curl | |
curl -G 'http://<host>:<port>/query?pretty=true' --data-urlencode "db=gofore" --data-urlencode "q=SELECT * FROM temperature WHERE device_id='1000'" | |
# Queryt | |
select * from temperature where time > now() - 6h and device_id = "1" | |
select last(value) from temperature, co, humidity where time > now() - 1m group by * | |
show tag values from temperature with key = "device_id" | |
# Continous queryt, aggregoidut taulut ja backfillit | |
Luodaan Continous Query: | |
CREATE CONTINUOUS QUERY temperature_cq ON gofore | |
RESAMPLE EVERY 1m | |
BEGIN | |
SELECT min(value) as min_temp, max(value) as max_temp, mean(value) as mean_temp | |
INTO temperature_5m | |
FROM temperature | |
GROUP BY time(5m), device_id | |
END | |
Tehdään backfill: | |
SELECT min(value) as min_temp, max(value) as max_temp, mean(value) as mean_temp | |
INTO "temperature_5m" | |
FROM temperature | |
WHERE time >= now() - 1h AND time < now() | |
GROUP BY time(5m), device_id | |
Tutkaillaan tuloksia: | |
select * from temperature_5m group by * | |
# Droppailu ja uudelleenluonti | |
drop continuous query temperature_cq on gofore | |
drop measurement temperature_5m | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment