Skip to content

Instantly share code, notes, and snippets.

@dgnorton
Created February 24, 2015 17:45
Show Gist options
  • Save dgnorton/d72f81c6c9f6a7a8df67 to your computer and use it in GitHub Desktop.
Save dgnorton/d72f81c6c9f6a7a8df67 to your computer and use it in GitHub Desktop.
dgnorton@maple:~/go/src/github.com/influxdb/influxdb/tests$ cat create_write_single_query.sh
echo "creating database"
curl -G http://localhost:8086/query --data-urlencode "q=CREATE DATABASE foo"
echo "creating retention policy"
curl -G http://localhost:8086/query --data-urlencode "q=CREATE RETENTION POLICY bar ON foo DURATION 1h REPLICATION 3 DEFAULT"
echo "inserting data"
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
echo "querying data"
curl -G http://localhost:8086/query --data-urlencode "db=foo" --data-urlencode "q=SELECT sum(value) FROM \"foo\".\"bar\".cpu GROUP BY time(1h)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment