From 111fda8d8730685c9a375cbbd554af24e7491c77 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Wed, 29 Aug 2018 12:20:00 -0500 Subject: [PATCH] Add device monitoring in containers The existing device monitoring was relying on block UUIDs which are not always populated within a container. This change converts the UUID use to device path which is always available no matter container engine type. Change-Id: Iec1493a58d9aab8b2a9cb67b9202e1751606bbc4 Signed-off-by: Kevin Carter --- .../roles/elastic_metricbeat/templates/metricbeat.yml.j2 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/elk_metrics_6x/roles/elastic_metricbeat/templates/metricbeat.yml.j2 b/elk_metrics_6x/roles/elastic_metricbeat/templates/metricbeat.yml.j2 index f997c801..54eb49bc 100644 --- a/elk_metrics_6x/roles/elastic_metricbeat/templates/metricbeat.yml.j2 +++ b/elk_metrics_6x/roles/elastic_metricbeat/templates/metricbeat.yml.j2 @@ -48,10 +48,9 @@ metricbeat.max_start_delay: 10s {% set metric_sets = ['network', 'process', 'process_summary', 'uptime'] %} {% if physical_host is defined and physical_host != inventory_hostname %} -{% set host_mount_uuids = (hostvars[physical_host]['ansible_mounts'] | map(attribute='uuid') | list) %} -{% set container_mount_uuids = (ansible_mounts | map(attribute='uuid') | list | difference(['N/A']) ) %} -{% set container_mount_fs_types = (ansible_mounts | map(attribute='fstype') | list) %} -{% if (((container_mount_uuids | difference(host_mount_uuids)) | length) > 0) or 'nfs4' in container_mount_fs_types %} +{% set host_mount_devices = (hostvars[physical_host]['ansible_mounts'] | map(attribute='device') | list) %} +{% set container_mount_devices = (ansible_mounts | map(attribute='device') | list) %} +{% if (((container_mount_devices | difference(host_mount_devices)) | length) > 0) | bool %} {% set _ = metric_sets.extend(['filesystem', 'fsstat']) %} {% endif %} {% else %}