Merge "Adds option to add extra scrape targets for node exporter"

This commit is contained in:
Zuul 2024-06-26 21:05:42 +00:00 committed by Gerrit Code Review
commit e4d578a390
4 changed files with 45 additions and 0 deletions

View File

@ -171,6 +171,11 @@ prometheus_mysql_exporter_database_user: "{% if use_preconfigured_databases | bo
prometheus_active_passive: true
prometheus_alertmanager_active_passive: true
####################
# Node Exporter
####################
prometheus_node_exporter_targets_extra: []
####################
# Blackbox
####################

View File

@ -42,6 +42,13 @@ scrape_configs:
instance: "{{ hostvars[host].prometheus_instance_label }}"
{% endif %}
{% endfor %}
{% for target in prometheus_node_exporter_targets_extra %}
- targets:
- '{{ target.target }}'
{% if target.labels | default({}, true) %}
labels: {{ target.labels | to_json }}
{% endif %}
{% endfor %}
{% endif %}
{% if enable_prometheus_mysqld_exporter | bool %}

View File

@ -217,3 +217,29 @@ sure to set the ``prometheus_instance_label`` variable to ``None``.
This feature may generate duplicate metrics temporarily while Prometheus
updates the metric labels. Please be aware of this while analyzing metrics
during the transition period.
Exporter configuration
~~~~~~~~~~~~~~~~~~~~~~
Node Exporter
-------------
Sometimes it can be useful to monitor hosts outside of the Kolla deployment.
One method of doing this is to configure a list of additional targets using the
``prometheus_node_exporter_targets_extra`` variable. The format of which
should be a list of dictionaries with the following keys:
* target: URL of node exporter to scrape
* labels: (Optional) A list of labels to set on the metrics scaped from this
exporter.
For example:
.. code-block:: yaml
:caption: ``/etc/kolla/globals.yml``
prometheus_node_exporter_targets_extra:
- target: http://10.0.0.1:1234
labels:
instance: host1

View File

@ -0,0 +1,7 @@
---
features:
- |
Adds ``prometheus_node_exporter_targets_extra`` to add additional scrape
targets to the node exporter job. See kolla-ansible-doc:`documentation
<reference/logging-and-monitoring/prometheus-guide.html>` for more
information.