I have a work around for this now. What I do is create the db from a shell
script, (this is for a different db, for gatling). But yes having all the
continuous queries listed in the conf file will be convenient
influx -execute 'DROP DATABASE "gatling"'
influx -execute 'CREATE DATABASE "gatling" WITH DURATION 3d REPLICATION 1
NAME "G_RS_DEFAULT"'
influx -execute 'CREATE RETENTION POLICY "gatlingRP" ON "gatling" DURATION
12w REPLICATION 1'
influx -execute 'CREATE CONTINUOUS QUERY "gRPS" ON gatling BEGIN SELECT
sum("count")/10 as "RPS" INTO "gatling"."gatlingRP"."rps" FROM "gatling"
WHERE "request" = '\''allRequests'\'' GROUP BY time(10s), "status" END'
influx -execute 'CREATE CONTINUOUS QUERY "gActivUsers" ON gatling BEGIN
SELECT sum("active")/10 as "activeUsers" INTO
"gatling"."gatlingRP"."activeUsers" FROM "gatling" WHERE "scenario" =
'\''allUsers'\'' GROUP BY time(10s) END'
influx -execute 'CREATE CONTINUOUS QUERY "gRT" ON gatling BEGIN SELECT
mean("mean") as "RT" INTO "gatling"."gatlingRP"."RT" FROM "gatling" WHERE
("status" = '\''ok'\'' or "status" = '\''ko'\'') GROUP BY time(10s),
"status" END'
On Wednesday, December 21, 2016 at 11:42:41 AM UTC-5, Mark Rushakoff wrote:
>
> I think this is the first time I've heard anyone ask for creating CQs at
> the same time as creating a database.
>
> Please open a feature request on the influxdb repository on GitHub if this
> is important for you.
>
> On Tuesday, December 20, 2016 at 9:01:00 PM UTC-8, Shoaib Khan wrote:
>>
>> Hey!
>>
>> I'm looking for a way to create continuous queries at the time of db
>> create. Here is what I'm trying to do with collectd and other measurements.
>>
>> create database "collectd" <- this creates the db based on the specs set
>> by the parameter typesdb
>>
>> [[collectd]]
>> enabled = true
>> bind-address = ":25826"
>> database = "collectd"
>> typesdb = "/usr/share/collectd/types.db"
>>
>>
>> Now I've to execute the create continuous query command after this is
>> created. I know once I have a working query I don't need to recreate it.
>> But I've to, at times drop and recreate the collectd db (I'm using tmpfs
>> here :p), or deploy influxdb/collectd/grafana on a new set of environments.
>>
>> I went through the docs and couldn't find anything that will help.
>>
>> Has anyone attempted this?
>>
>> Following is one of the few continuous queries I'm creating. They work
>> well,
>>
>> CREATE CONTINUOUS QUERY "net_rx" ON collectd BEGIN SELECT
>> non_negative_derivative(max("value"), 1s) INTO "netread" FROM
>> "interface_rx" WHERE "type" = 'if_octets' AND "instance" = 'eth0' GROUP BY
>> time(10s) END
>>
>> CREATE CONTINUOUS QUERY "net_tx" ON collectd BEGIN SELECT
>> -1*non_negative_derivative(max("value"), 1s) INTO "netwrite" FROM
>> "interface_rx" WHERE "type" = 'if_octets' AND "instance" = 'eth0' GROUP BY
>> time(10s) END
>>
>>
--
Remember to include the version number!
---
You received this message because you are subscribed to the Google Groups
"InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit
https://groups.google.com/d/msgid/influxdb/bc252677-0b6a-4df8-9509-b7a02692ccc3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.