Add InfluxDB stack to Docker Swarm

Change-Id: If219369574e3af5eeedf3f52967e94b9c9d06f34
Depends-On: I5e815109987f928024f05cdaa99de6f558866174
diff --git a/docker/swarm/stack/influxdb.yml b/docker/swarm/stack/influxdb.yml
new file mode 100644
index 0000000..e753d18
--- /dev/null
+++ b/docker/swarm/stack/influxdb.yml
@@ -0,0 +1,29 @@
+classes:
+- system.influxdb.server.container
+- system.influxdb.server.tmpfs_wal
+- system.telegraf.agent.remote.input.influxdb
+parameters:
+  _param:
+    docker_influxdb_replicas: 1
+    docker_influxdb_data_dir: /srv/volumes/influxdb
+  docker:
+    client:
+      stack:
+        influxdb:
+          service:
+            server:
+              deploy:
+                replicas: ${_param:docker_influxdb_replicas}
+                restart_policy:
+                  condition: any
+              environment:
+                INFLUXDB_CONFIG_PATH: /etc/influxdb/influxdb.conf
+                INFLUXDB_DATA_DIR: /var/lib/influxdb/data
+                INFLUXDB_DATA_WAL_DIR: /var/lib/influxdb/wal
+              image: ${_param:docker_influxdb_image}
+              ports:
+              - 15016:8086
+              volumes:
+              - ${influxdb:server:prefix_dir}/etc/influxdb:/etc/influxdb
+              - ${_param:docker_influxdb_data_dir}:/var/lib/influxdb/data
+              - ${influxdb:server:data:wal_dir}:/var/lib/influxdb/wal
diff --git a/influxdb/server/container.yml b/influxdb/server/container.yml
new file mode 100644
index 0000000..d7e7df7
--- /dev/null
+++ b/influxdb/server/container.yml
@@ -0,0 +1,19 @@
+classes:
+- service.influxdb.server.container
+parameters:
+  influxdb:
+    server:
+      enabled: true
+      prefix_dir: /srv/volumes/local/influxdb
+      http:
+        enabled: true
+        bind:
+          port: 8086
+      admin:
+        enabled: true
+        bind:
+          port: 8083
+        user:
+          enabled: true
+          name: 'root'
+          password: ${_param:influxdb_admin_password}
diff --git a/telegraf/agent/remote/input/influxdb.yml b/telegraf/agent/remote/input/influxdb.yml
new file mode 100644
index 0000000..9b28476
--- /dev/null
+++ b/telegraf/agent/remote/input/influxdb.yml
@@ -0,0 +1,12 @@
+parameters:
+  _param:
+    telegraf_remote_agent_influxdb_port: 15016
+    telegraf_remote_agent_influxdb_protocol: http
+  telegraf:
+    remote_agent:
+      input:
+        influxdb:
+          servers:
+          - url: "${_param:telegraf_remote_agent_influxdb_protocol}://${_param:telegraf_remote_agent_influxdb_address}:${_param:telegraf_remote_agent_influxdb_port}/debug/vars"
+          tags:
+            host: ${_param:telegraf_remote_agent_influxdb_address}