From 0c60cbe8de082fcd77758dc1c861c48b7d220f32 Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Wed, 19 Oct 2016 22:15:48 +0200 Subject: [PATCH] Collect haproxy/elasticsearch/memcached metrics only on related hosts Change-Id: Ifa72d352e65c834afa078a7b08a7582155e6298b Closes-bug: #1635032 --- ansible/roles/telegraf/templates/telegraf.conf.j2 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ansible/roles/telegraf/templates/telegraf.conf.j2 b/ansible/roles/telegraf/templates/telegraf.conf.j2 index 0788f854d4..457afa0211 100644 --- a/ansible/roles/telegraf/templates/telegraf.conf.j2 +++ b/ansible/roles/telegraf/templates/telegraf.conf.j2 @@ -33,21 +33,21 @@ files = ["/var/log/kolla/**.log"] [[inputs.system]] [[inputs.net]] interfaces = [] -{% if enable_haproxy | bool %} +{% if inventory_hostname in groups['haproxy'] and enable_haproxy | bool %} [[inputs.haproxy]] servers = ["{{ haproxy_proto }}://{{ haproxy_user }}:{{ haproxy_password }}@{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ haproxy_stats_port }}"] {% endif %} -{% if enable_memcached | bool %} +{% if inventory_hostname in groups['memcached'] and enable_memcached | bool %} [[inputs.memcached]] servers = ["{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ memcached_port }}"] {% endif %} -{% if enable_elasticsearch | bool %} +{% if inventory_hostname in groups['elasticsearch'] and enable_elasticsearch | bool %} [[inputs.elasticsearch]] servers = ["{{ elasticsearch_proto }}://{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ elasticsearch_port }}"] local = true cluster_health = true {% endif %} -{% if inventory_hostname in groups['rabbitmq'] %} +{% if inventory_hostname in groups['rabbitmq'] and enable_rabbitmq | bool %} [[inputs.rabbitmq]] url = "{{ rabbitmq_proto }}://{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ rabbitmq_management_port }}" username = "{{ rabbitmq_user }}"