Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds option to add extra scrape targets for node exporter #599

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ansible/roles/prometheus/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,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
####################
Expand Down
7 changes: 7 additions & 0 deletions ansible/roles/prometheus/templates/prometheus.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ scrape_configs:
{% for host in groups['prometheus-node-exporter'] %}
- '{{ 'api' | kolla_address(host) | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_node_exporter_port'] }}'
{% 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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,29 @@ files:
- 192.168.1.1
labels:
job: ipmi_exporter

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

Original file line number Diff line number Diff line change
@@ -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.