Add FS detection in metricbeat for containers
When deploying metricbeat there are some container environments that will have a mount point within the container that may differ from that of the host; like in the case of an LXC container with an LVM backed bind mount or an NFS share. This change will now check if the filesystem within a container has any mounts and compare the return to that of the provided physical host if the list is >0 the fs checks will be deployed within the contianer environment. Change-Id: Iae5827f4e7e0a85eb733128b54d6ef4c8721537a Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
023b303e76
commit
d69c75e8e4
@ -100,3 +100,7 @@
|
||||
}}
|
||||
settings:
|
||||
number_of_replicas: "{{ elasticsearch_number_of_replicas | int }}"
|
||||
index:
|
||||
mapping:
|
||||
total_fields:
|
||||
limit: "3072"
|
||||
|
@ -25,6 +25,15 @@
|
||||
tags:
|
||||
- always
|
||||
|
||||
- name: Refresh physical host facts
|
||||
setup: {}
|
||||
delegate_to: "{{ physical_host }}"
|
||||
delegate_facts: true
|
||||
when:
|
||||
- physical_host is defined and physical_host != inventory_hostname
|
||||
tags:
|
||||
- always
|
||||
|
||||
- name: Ensure beat is installed
|
||||
package:
|
||||
name: "{{ metricbeat_distro_packages }}"
|
||||
|
@ -45,26 +45,38 @@ metricbeat.max_start_delay: 10s
|
||||
# hosts: ["${host}:2379"]
|
||||
|
||||
#========================== Modules configuration ============================
|
||||
|
||||
{% 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 _ = metric_sets.extend(['filesystem', 'fsstat']) %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% set _ = metric_sets.extend(['cpu', 'load', 'memory', 'core', 'diskio', 'raid', 'socket', 'filesystem', 'fsstat']) %}
|
||||
{% endif %}
|
||||
metricbeat.modules:
|
||||
{% if (not physical_host is defined) or (physical_host is defined and physical_host == inventory_hostname) %}
|
||||
#------------------------------- System Module -------------------------------
|
||||
# metricsets:
|
||||
# - cpu # CPU usage
|
||||
# - filesystem # File system usage for each mountpoint
|
||||
# - fsstat # File system summary metrics
|
||||
# - load # CPU load averages
|
||||
# - memory # Memory usage
|
||||
# - network # Network IO
|
||||
# - process # Per process metrics
|
||||
# - process_summary # Process summary
|
||||
# - uptime # System Uptime
|
||||
# - core # Per CPU core usage
|
||||
# - diskio # Disk IO
|
||||
# - raid # Raid
|
||||
# - socket # Sockets and connection info (linux only)
|
||||
- module: system
|
||||
metricsets:
|
||||
- cpu # CPU usage
|
||||
- filesystem # File system usage for each mountpoint
|
||||
- fsstat # File system summary metrics
|
||||
- load # CPU load averages
|
||||
- memory # Memory usage
|
||||
- network # Network IO
|
||||
- process # Per process metrics
|
||||
- process_summary # Process summary
|
||||
- uptime # System Uptime
|
||||
- core # Per CPU core usage
|
||||
- diskio # Disk IO
|
||||
- raid # Raid
|
||||
- socket # Sockets and connection info (linux only)
|
||||
metricsets: {{ metric_sets }}
|
||||
enabled: true
|
||||
period: 30s
|
||||
period: 60s
|
||||
processes: ['.*']
|
||||
|
||||
# Configure the metric types that are included by these metricsets.
|
||||
@ -111,7 +123,7 @@ metricbeat.modules:
|
||||
socket.reverse_lookup.enabled: true
|
||||
socket.reverse_lookup.success_ttl: 60s
|
||||
socket.reverse_lookup.failure_ttl: 60s
|
||||
{% endif %}
|
||||
|
||||
##------------------------------ Aerospike Module -----------------------------
|
||||
#- module: aerospike
|
||||
# metricsets: ["namespace"]
|
||||
|
Loading…
Reference in New Issue
Block a user