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 <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2018-08-29 12:20:00 -05:00
parent 41aac76b54
commit 111fda8d87
No known key found for this signature in database
GPG Key ID: 9443251A787B9FB3

View File

@ -48,10 +48,9 @@ metricbeat.max_start_delay: 10s
{% set metric_sets = ['network', 'process', 'process_summary', 'uptime'] %} {% set metric_sets = ['network', 'process', 'process_summary', 'uptime'] %}
{% if physical_host is defined and physical_host != inventory_hostname %} {% if physical_host is defined and physical_host != inventory_hostname %}
{% set host_mount_uuids = (hostvars[physical_host]['ansible_mounts'] | map(attribute='uuid') | list) %} {% set host_mount_devices = (hostvars[physical_host]['ansible_mounts'] | map(attribute='device') | list) %}
{% set container_mount_uuids = (ansible_mounts | map(attribute='uuid') | list | difference(['N/A']) ) %} {% set container_mount_devices = (ansible_mounts | map(attribute='device') | list) %}
{% set container_mount_fs_types = (ansible_mounts | map(attribute='fstype') | list) %} {% if (((container_mount_devices | difference(host_mount_devices)) | length) > 0) | bool %}
{% if (((container_mount_uuids | difference(host_mount_uuids)) | length) > 0) or 'nfs4' in container_mount_fs_types %}
{% set _ = metric_sets.extend(['filesystem', 'fsstat']) %} {% set _ = metric_sets.extend(['filesystem', 'fsstat']) %}
{% endif %} {% endif %}
{% else %} {% else %}