diff --git a/elk_metrics_6x/createElasticIndexes.yml b/elk_metrics_6x/createElasticIndexes.yml index 95f6c689..15ce4233 100644 --- a/elk_metrics_6x/createElasticIndexes.yml +++ b/elk_metrics_6x/createElasticIndexes.yml @@ -100,3 +100,7 @@ }} settings: number_of_replicas: "{{ elasticsearch_number_of_replicas | int }}" + index: + mapping: + total_fields: + limit: "3072" diff --git a/elk_metrics_6x/roles/elastic_metricbeat/tasks/main.yml b/elk_metrics_6x/roles/elastic_metricbeat/tasks/main.yml index 387a4ce5..e8675ec5 100644 --- a/elk_metrics_6x/roles/elastic_metricbeat/tasks/main.yml +++ b/elk_metrics_6x/roles/elastic_metricbeat/tasks/main.yml @@ -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 }}" 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 920df89b..d8fdf8d2 100644 --- a/elk_metrics_6x/roles/elastic_metricbeat/templates/metricbeat.yml.j2 +++ b/elk_metrics_6x/roles/elastic_metricbeat/templates/metricbeat.yml.j2 @@ -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"]