From b95ff2d1dba3f857381675f38be297250e6433f7 Mon Sep 17 00:00:00 2001 From: Keith Plant Date: Thu, 8 Aug 2019 13:20:20 -0400 Subject: [PATCH] Configure Telegraf to monitor Docker containers Added configuration to ansible/roles/telegraf/templates/telegraf.conf.j2 to allow telegraf to grab telemetry data from docker directly. Added option to etc/kolla/globals.yml to switch on/off the configuration to ingest data from the docker daemon into telegraf. Change-Id: Icbebc415d643a237fa128840d5f5a9c91d22c12d Signed-off-by: Keith Plant --- ansible/group_vars/all.yml | 7 +++++++ ansible/roles/telegraf/templates/telegraf.conf.j2 | 13 +++++++++++++ etc/kolla/globals.yml | 7 +++++++ 3 files changed, 27 insertions(+) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 23f3bc6e86..f15389bfaf 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -1062,3 +1062,10 @@ distro_python_version_map: { } distro_python_version: "{{ distro_python_version_map[kolla_base_distro] }}" + +########## +# Telegraf +########## +# Configure telegraf to use the docker daemon itself as an input for +# telemetry data. +telegraf_enable_docker_input: "no" diff --git a/ansible/roles/telegraf/templates/telegraf.conf.j2 b/ansible/roles/telegraf/templates/telegraf.conf.j2 index 6d5cad699c..76030cfb94 100644 --- a/ansible/roles/telegraf/templates/telegraf.conf.j2 +++ b/ansible/roles/telegraf/templates/telegraf.conf.j2 @@ -108,3 +108,16 @@ gather_perf_events_statements = true interval_slow = "30m" {% endif %} +{% if telegraf_enable_docker_input | bool %} +[[inputs.docker]] + endpoint = "unix:///var/run/docker.sock" + gather_services = false + container_names = [] + container_name_include = [] + container_name_exclude = [] + timeout = "5s" + perdevice = true + total = false + docker_label_include = [] + docker_label_exclude = [] +{% endif %} diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml index 006c2adc2e..8e18caaa92 100644 --- a/etc/kolla/globals.yml +++ b/etc/kolla/globals.yml @@ -585,3 +585,10 @@ # by kolla-ansible. You must first setup an external elasticsearch with 2.3.0. # By default, kolla-ansible deployed mariadb is the used database backend. #freezer_database_backend: "mariadb" + +########## +# Telegraf +########## +# Configure telegraf to use the docker daemon itself as an input for +# telemetry data. +#telegraf_enable_docker_input: "no"