From 7764ed9894479cb729f38fcafc8c4a9001318045 Mon Sep 17 00:00:00 2001 From: Kevin TIBI Date: Tue, 30 Jan 2018 16:03:13 +0100 Subject: [PATCH] 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 --- ansible/roles/telegraf/templates/telegraf.conf.j2 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ansible/roles/telegraf/templates/telegraf.conf.j2 b/ansible/roles/telegraf/templates/telegraf.conf.j2 index 52e67f0ff4..5f6fd9ae6a 100644 --- a/ansible/roles/telegraf/templates/telegraf.conf.j2 +++ b/ansible/roles/telegraf/templates/telegraf.conf.j2 @@ -12,12 +12,14 @@ hostname = "" omit_hostname = false {% if enable_influxdb | bool %} +{% for host in groups['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 retention_policy = "autogen" write_consistency = "any" timeout = "5s" +{% endfor %} {% endif %} [[inputs.cpu]] percpu = true