Adds option to add extra scrape targets for node exporter

This enables you to scrape external targets more easily.

Change-Id: I55b612d2f5f5a3fc8d21c6d2f71d6c58d89d4e31
This commit is contained in:
Will Szumski 2024-04-16 09:58:23 +01:00 committed by Pierre Riteau
parent de1552b7d7
commit 582e2490ca
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.