Okay I’m probably late to the party here but I’ve worked this out.
With a bit of rewiring, I’ve set up a kubernetes job (k8s 1.9.0) that will prime the influx database with:
Database to use
2 Retention policies
- name: database-creator
command: [“sh”, “-c”, “/tmp/createdbs.sh”]
- name: init-influx-database
command: [‘sh’, ‘-c’, ‘until nslookup influxdb-service; do echo waiting for influxdb-service; sleep 2; done;’]
(init containers in k8s are supported pre-1.9.0 but is formatted a different way)
My createdbs.sh script is:
influx -host influxdb-service -import -path=/tmp/databases.txt
CREATE DATABASE java_services
CREATE RETENTION POLICY oneday ON java_services DURATION 1d REPLICATION 1
CREATE RETENTION POLICY oneweek ON java_services DURATION 7d REPLICATION 1
I can then configure telegraf with the name of the pre-defined database “java_services” and retention policy “oneweek”:
urls = ["http://influxdb-service:8086"]
database = "java_services" # required
retention_policy = "oneweek"
write_consistency = "any"
This then creates 3 views in chronograf:
My assumption from here is that you would create a Continuous Query to roll up data to the other retention policy(?)