Add influxdb output
Change-Id: Ib2cde6a445cc4f3c323e12b7172c2e1caafa1bc5
diff --git a/README.rst b/README.rst
index 120f21b..f639b97 100644
--- a/README.rst
+++ b/README.rst
@@ -25,6 +25,20 @@
port: 9126
engine: prometheus
+Influx output
+-------------
+
+.. code-block:: yaml
+
+ telegraf:
+ agent:
+ output:
+ influxdb:
+ urls:
+ - http://127.0.0.1:8086
+ database: test-telegraf
+ write_consistency: any
+ timeout: 10s
Documentation and Bugs
======================
diff --git a/metadata/service/agent/output/influxdb.yml b/metadata/service/agent/output/influxdb.yml
new file mode 100644
index 0000000..cd4fe6f
--- /dev/null
+++ b/metadata/service/agent/output/influxdb.yml
@@ -0,0 +1,10 @@
+parameters:
+ telegraf:
+ agent:
+ output:
+ influxdb:
+ # urls: ['http://127.0.0.1:8086']
+ database: telegraf
+ timeout: 30s
+ retention_policy: default
+ write_consistency: any
diff --git a/telegraf/files/output/influxdb.conf b/telegraf/files/output/influxdb.conf
new file mode 100644
index 0000000..37e549f
--- /dev/null
+++ b/telegraf/files/output/influxdb.conf
@@ -0,0 +1,9 @@
+[[outputs.{{ name }}]]
+{%- if values is defined %}
+listen = ""
+ urls = {{ values.urls|yaml }}
+ database = {{ values.database }}
+ retention_policy = {{ values.get('retention_policy', "") }}
+ write_consistency = {{ values.get('write_consistency', "any") }}
+ timeout = {{ values.get('timeout', "5s") }}
+{%- endif %}
diff --git a/tests/pillar/telegraf_agent.sls b/tests/pillar/telegraf_agent.sls
index c0d4f33..d1d7a43 100644
--- a/tests/pillar/telegraf_agent.sls
+++ b/tests/pillar/telegraf_agent.sls
@@ -23,6 +23,12 @@
address: 127.0.0.1
port: 9126
engine: prometheus
+ influxdb:
+ urls:
+ - http://127.0.0.1:8086
+ database: test-telegraf
+ write_consistency: any
+ timeout: 10s
input:
cpu:
totalcpu: totalcpu_value