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
This commit is contained in:
Michael Vollman 2018-11-12 13:38:20 -05:00
parent 2923df2295
commit 0ea548f979
2 changed files with 4 additions and 8 deletions

View File

@ -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 }}

View File

@ -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
#