Created
February 17, 2015 20:57
-
-
Save dgnorton/71c37265159c96fe5664 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
printf "creating database\n" | |
curl -G http://localhost:8086/query --data-urlencode "q=CREATE DATABASE foo" | |
printf "creating retention policy\n" | |
curl -G http://localhost:8086/query --data-urlencode "q=CREATE RETENTION POLICY bar ON foo DURATION 5s REPLICATION 3 DEFAULT" | |
printf "inserting data\n" | |
curl -d '{"database" : "foo", "retentionPolicy" : "bar", "points": [{"name": "cpu", "tags": {"host": "server01"},"timestamp": "2015-01-26T22:01:11.703Z","values": {"value": 100}}]}' -H "Content-Type: application/json" http://localhost:8086/write | |
printf "querying data\n" | |
curl -G http://localhost:8086/query --data-urlencode "db=foo" --data-urlencode "q=SELECT * FROM cpu" | |
printf "\nwaiting for retention cleanup\n" | |
sleep 12 | |
printf "inserting data after retention cleanup\n" | |
curl -d '{"database" : "foo", "retentionPolicy" : "bar", "points": [{"name": "cpu", "tags": {"host": "server01"},"timestamp": "2015-01-26T22:01:11.704Z","values": {"value": 200}}]}' -H "Content-Type: application/json" http://localhost:8086/write | |
printf "querying data after retention cleanup\n" | |
curl -G http://localhost:8086/query --data-urlencode "db=foo" --data-urlencode "q=SELECT * FROM cpu" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment