Created
April 1, 2015 20:33
-
-
Save btashton/0ed2712c8738770238f5 to your computer and use it in GitHub Desktop.
cq.sh
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
# Create a fresh database, add some data, create a continuous query, list continuous queries, drop continuous query | |
curl -v -G http://localhost:8086/query --data-urlencode "q=DROP DATABASE mydb" | |
echo | |
curl -v -G http://localhost:8086/query --data-urlencode "q=CREATE DATABASE mydb" | |
echo | |
curl -v -XPOST 'http://localhost:8086/write' -d ' | |
{ | |
"database": "mydb", | |
"retentionPolicy": "default", | |
"points": [ | |
{ | |
"name": "cpu_load_short", | |
"tags": { | |
"host": "server01", | |
"region": "us-west" | |
}, | |
"fields": { | |
"value": 0.64, "device_id": 1213 | |
} | |
} | |
] | |
} | |
' | |
echo | |
curl -v -G http://localhost:8086/query --data-urlencode 'q= | |
CREATE CONTINUOUS QUERY myquery ON mydb BEGIN SELECT count(value) INTO measure1 FROM cpu_load_short GROUP BY time(10m) END | |
' | |
echo | |
curl -v -G http://localhost:8086/query --data-urlencode 'q= | |
SHOW CONTINUOUS QUERIES | |
' | |
echo | |
curl -v -G http://localhost:8086/query --data-urlencode 'q= | |
DROP CONTINUOUS QUERY myquery ON mydb | |
' | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment