From 0ea548f97985c7704a1d19e4a557d5de42813ba0 Mon Sep 17 00:00:00 2001 From: Michael Vollman Date: Mon, 12 Nov 2018 13:38:20 -0500 Subject: [PATCH] Add missing prometheus port for ceph auto discover When ceph prometheus metrics are auto discovered the metricbeat config should point to the ceph mgr prometheus port. Adding missing brackets around metricset so the default is treated as an array. Dropping ceph dir detection for prometheus auto discover and relying on is the port availability and inventory group only. Change-Id: Iaba0fdece00414e17bc172f39e624374a9d273e8 --- elk_metrics_6x/roles/elastic_metricbeat/tasks/main.yml | 8 ++------ .../roles/elastic_metricbeat/templates/metricbeat.yml.j2 | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/elk_metrics_6x/roles/elastic_metricbeat/tasks/main.yml b/elk_metrics_6x/roles/elastic_metricbeat/tasks/main.yml index 22cd8a06..abd66be0 100644 --- a/elk_metrics_6x/roles/elastic_metricbeat/tasks/main.yml +++ b/elk_metrics_6x/roles/elastic_metricbeat/tasks/main.yml @@ -197,12 +197,8 @@ ceph_prometheus_enabled: |- {% set ceph_detect = false %} - {% if ceph_prometheus_listening is defined %} - {% if (ceph_mons is defined) and (ceph_mons | length > 0) and (inventory_hostname in groups[ceph_metricbeat_group]) %} - {% set ceph_detect = true %} - {% else %} - {% set ceph_detect = ceph.stat.exists | bool %} - {% endif %} + {% if ceph_prometheus_listening is defined and (inventory_hostname in groups[ceph_metricbeat_group]) %} + {% set ceph_detect = true %} {% endif %} {{ ceph_detect }} 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 77cb5959..9fdf54bd 100644 --- a/elk_metrics_6x/roles/elastic_metricbeat/templates/metricbeat.yml.j2 +++ b/elk_metrics_6x/roles/elastic_metricbeat/templates/metricbeat.yml.j2 @@ -458,7 +458,7 @@ metricbeat.modules: {% if (prometheus_enabled | default(false) | bool) and (prometheus_config is defined) %} {% for prometheus in prometheus_config %} - module: prometheus - metricsets: [{% for mset in prometheus.metricsets|default("collector") %}"{{ mset }}"{% if not loop.last %},{% endif %}{% endfor %}] + metricsets: [{% for mset in prometheus.metricsets|default(["collector"]) %}"{{ mset }}"{% if not loop.last %},{% endif %}{% endfor %}] enabled: {{ prometheus.enabled | default('true') }} period: {{ prometheus.period | default("10s") }} hosts: [{% for phost in prometheus.hosts %}"{{ phost }}"{% if not loop.last %},{% endif %}{% endfor %}] @@ -472,7 +472,7 @@ metricbeat.modules: metricsets: ["collector"] enabled: 'true' period: "10s" - hosts: [{% for phost in ceph_stats_hosts %}"{{ phost | regex_replace(':\\d+$', '') }}"{% if not loop.last %},{% endif %}{% endfor %}] + hosts: [{% for phost in ceph_stats_hosts %}"{{ phost | regex_replace(':\\d+$', '') }}:9283"{% if not loop.last %},{% endif %}{% endfor %}] metrics_path: "/metrics" namespace: ceph #