From 2a8cb0b781acb7f21d63031e2aedfde2084e1190 Mon Sep 17 00:00:00 2001 From: pangliye Date: Wed, 17 May 2017 03:59:16 -0400 Subject: [PATCH] Modify the configuration file of telegraf Influxdb is standalone deployed by kolla-ansible, The cluster mode is charged now. Previously configured, each telegraf monitors all influxdb. If the telegraf is more, It is a disaster to influxdb. So, telegraf should monitor influxdb deployed on the same server. Change-Id: I9f4003a55de2a7be53c644b1d2f89d00cdf9478a --- 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 db7718e1d8..bde838dd90 100644 --- a/ansible/roles/telegraf/templates/telegraf.conf.j2 +++ b/ansible/roles/telegraf/templates/telegraf.conf.j2 @@ -24,8 +24,10 @@ [[inputs.disk]] ignore_fs = ["tmpfs", "devtmpfs"] [[inputs.diskio]] +{% if inventory_hostname in groups['influxdb'] and enable_influxdb | bool %} [[inputs.influxdb]] - urls = [{% for host in groups['influxdb'] %}"{{ influxdb_proto }}://{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address']}}:{{ influxdb_http_port }}/debug/vars"{% if not loop.last %},{% endif %}{% endfor %}] + urls = ["{{ influxdb_proto }}://{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ influxdb_http_port }}/debug/vars"] +{% endif %} [[inputs.kernel]] [[inputs.mem]] [[inputs.processes]]