From 20dcf18064461fe64d3f8ab6ddcca999fb684bae Mon Sep 17 00:00:00 2001 From: Michael Vollman Date: Wed, 17 Oct 2018 09:31:07 -0400 Subject: [PATCH] Add vars to configure prometheus module Add new vars prometheus_enabled and prometheus_config to be used to configure the metricbeats prometheus module. The module will be used to query prometheus exporters and write the metrics pulled from prometheus to elasticsearch. Change-Id: I6c52e28cc982a13472aa8f6d3098a22adcb7d3c1 --- .../templates/metricbeat.yml.j2 | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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 152a1bcd..3c7e5eaa 100644 --- a/elk_metrics_6x/roles/elastic_metricbeat/templates/metricbeat.yml.j2 +++ b/elk_metrics_6x/roles/elastic_metricbeat/templates/metricbeat.yml.j2 @@ -455,13 +455,18 @@ metricbeat.modules: # #password: pass # ##----------------------------- Prometheus Module ----------------------------- -#- module: prometheus -# metricsets: ["stats"] -# period: 30s -# hosts: ["localhost:9090"] -# metrics_path: /metrics -# #namespace: example +{% 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 %}] + enabled: {{ prometheus.enabled | default('true') }} + period: {{ prometheus.period | default("10s") }} + hosts: [{% for phost in prometheus.hosts %}"{{ phost }}"{% if not loop.last %},{% endif %}{% endfor %}] + metrics_path: {{ prometheus.metrics_path | default("/metrics") }} + namespace: {{ prometheus.namespace }} # +{% endfor %} +{% endif %} ##------------------------------ RabbitMQ Module ------------------------------ {% if (rabbitmq_enabled | default(false) | bool) and (rabbitmq_monitoring_password is defined) %} - module: rabbitmq