Fix telegraf output for influxdb

Kolla add multiple url in one outputs.influxdb.
This configuration is when influxdb is in cluster mode.
We need to write one conf by influxdb server.

Change-Id: I1c788b3c8400e74d50cace5a334311408989c5e1
This commit is contained in:
Kevin TIBI 2018-01-30 16:03:13 +01:00 committed by Christian Berendt
parent e66cb5d46b
commit 7764ed9894

View File

@ -12,12 +12,14 @@
hostname = "" hostname = ""
omit_hostname = false omit_hostname = false
{% if enable_influxdb | bool %} {% if enable_influxdb | bool %}
{% for host in groups['influxdb'] %}
[[outputs.influxdb]] [[outputs.influxdb]]
urls = [{% for host in groups['influxdb'] %}"{{ influxdb_proto }}://{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address']}}:{{ influxdb_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}] urls = ["{{ influxdb_proto }}://{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address']}}:{{ influxdb_http_port }}"]
database = "telegraf" # required database = "telegraf" # required
retention_policy = "autogen" retention_policy = "autogen"
write_consistency = "any" write_consistency = "any"
timeout = "5s" timeout = "5s"
{% endfor %}
{% endif %} {% endif %}
[[inputs.cpu]] [[inputs.cpu]]
percpu = true percpu = true