Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kolla Ansible
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Very Demiurge Very Mindful
Kolla Ansible
Commits
2146015c
Commit
2146015c
authored
3 years ago
by
Zuul
Committed by
Gerrit Code Review
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Revert "Use friendly target names in Prometheus""
parents
fb26785c
c358a2d5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ansible/roles/prometheus/templates/prometheus.yml.j2
+12
-60
12 additions, 60 deletions
ansible/roles/prometheus/templates/prometheus.yml.j2
releasenotes/notes/fix-1955563-42a14bb080e15df2.yaml
+9
-0
9 additions, 0 deletions
releasenotes/notes/fix-1955563-42a14bb080e15df2.yaml
with
21 additions
and
60 deletions
ansible/roles/prometheus/templates/prometheus.yml.j2
+
12
−
60
View file @
2146015c
...
@@ -17,24 +17,16 @@ scrape_configs:
...
@@ -17,24 +17,16 @@ scrape_configs:
static_configs:
static_configs:
- targets:
- targets:
{% for host in groups['prometheus'] %}
{% for host in groups['prometheus'] %}
- '{{
host
}}:{{ prometheus_port }}'
- '{{
'api' | kolla_address(host) | put_address_in_context('url')
}}:{{ prometheus_port }}'
{% endfor %}
{% endfor %}
relabel_configs:
- source_labels: [__address__]
regex: "([^:]+):\\d+"
target_label: instance
{% if enable_prometheus_node_exporter | bool %}
{% if enable_prometheus_node_exporter | bool %}
- job_name: node
- job_name: node
static_configs:
static_configs:
- targets:
- targets:
{% for host in groups['prometheus-node-exporter'] %}
{% for host in groups['prometheus-node-exporter'] %}
- '{{
host
}}:{{ hostvars[host]['prometheus_node_exporter_port'] }}'
- '{{
'api' | kolla_address(host) | put_address_in_context('url')
}}:{{ hostvars[host]['prometheus_node_exporter_port'] }}'
{% endfor %}
{% endfor %}
relabel_configs:
- source_labels: [__address__]
regex: "([^:]+):\\d+"
target_label: instance
{% endif %}
{% endif %}
{% if enable_prometheus_mysqld_exporter | bool %}
{% if enable_prometheus_mysqld_exporter | bool %}
...
@@ -42,12 +34,8 @@ scrape_configs:
...
@@ -42,12 +34,8 @@ scrape_configs:
static_configs:
static_configs:
- targets:
- targets:
{% for host in groups['prometheus-mysqld-exporter'] %}
{% for host in groups['prometheus-mysqld-exporter'] %}
- '{{
host
}}:{{ hostvars[host]['prometheus_mysqld_exporter_port'] }}'
- '{{
'api' | kolla_address(host) | put_address_in_context('url')
}}:{{ hostvars[host]['prometheus_mysqld_exporter_port'] }}'
{% endfor %}
{% endfor %}
relabel_configs:
- source_labels: [__address__]
regex: "([^:]+):\\d+"
target_label: instance
{% endif %}
{% endif %}
{% if enable_prometheus_haproxy_exporter | bool %}
{% if enable_prometheus_haproxy_exporter | bool %}
...
@@ -55,12 +43,8 @@ scrape_configs:
...
@@ -55,12 +43,8 @@ scrape_configs:
static_configs:
static_configs:
- targets:
- targets:
{% for host in groups['prometheus-haproxy-exporter'] %}
{% for host in groups['prometheus-haproxy-exporter'] %}
- '{{
host
}}:{{ hostvars[host]['prometheus_haproxy_exporter_port'] }}'
- '{{
'api' | kolla_address(host) | put_address_in_context('url')
}}:{{ hostvars[host]['prometheus_haproxy_exporter_port'] }}'
{% endfor %}
{% endfor %}
relabel_configs:
- source_labels: [__address__]
regex: "([^:]+):\\d+"
target_label: instance
{% endif %}
{% endif %}
{% if enable_prometheus_rabbitmq_exporter | bool %}
{% if enable_prometheus_rabbitmq_exporter | bool %}
...
@@ -68,12 +52,8 @@ scrape_configs:
...
@@ -68,12 +52,8 @@ scrape_configs:
static_configs:
static_configs:
- targets:
- targets:
{% for host in groups['rabbitmq'] %}
{% for host in groups['rabbitmq'] %}
- '{{
host
}}:{{ hostvars[host]['prometheus_rabbitmq_exporter_port'] }}'
- '{{
'api' | kolla_address(host) | put_address_in_context('url')
}}:{{ hostvars[host]['prometheus_rabbitmq_exporter_port'] }}'
{% endfor %}
{% endfor %}
relabel_configs:
- source_labels: [__address__]
regex: "([^:]+):\\d+"
target_label: instance
{% endif %}
{% endif %}
{% if enable_prometheus_memcached_exporter | bool %}
{% if enable_prometheus_memcached_exporter | bool %}
...
@@ -81,12 +61,8 @@ scrape_configs:
...
@@ -81,12 +61,8 @@ scrape_configs:
static_configs:
static_configs:
- targets:
- targets:
{% for host in groups['prometheus-memcached-exporter'] %}
{% for host in groups['prometheus-memcached-exporter'] %}
- '{{
host
}}:{{ hostvars[host]['prometheus_memcached_exporter_port'] }}'
- '{{
'api' | kolla_address(host) | put_address_in_context('url')
}}:{{ hostvars[host]['prometheus_memcached_exporter_port'] }}'
{% endfor %}
{% endfor %}
relabel_configs:
- source_labels: [__address__]
regex: "([^:]+):\\d+"
target_label: instance
{% endif %}
{% endif %}
{% if enable_prometheus_cadvisor | bool %}
{% if enable_prometheus_cadvisor | bool %}
...
@@ -94,12 +70,8 @@ scrape_configs:
...
@@ -94,12 +70,8 @@ scrape_configs:
static_configs:
static_configs:
- targets:
- targets:
{% for host in groups["prometheus-cadvisor"] %}
{% for host in groups["prometheus-cadvisor"] %}
- '{{
host
}}:{{ hostvars[host]['prometheus_cadvisor_port'] }}'
- '{{
'api' | kolla_address(host) | put_address_in_context('url')
}}:{{ hostvars[host]['prometheus_cadvisor_port'] }}'
{% endfor %}
{% endfor %}
relabel_configs:
- source_labels: [__address__]
regex: "([^:]+):\\d+"
target_label: instance
{% endif %}
{% endif %}
{% if enable_prometheus_fluentd_integration | bool %}
{% if enable_prometheus_fluentd_integration | bool %}
...
@@ -107,12 +79,8 @@ scrape_configs:
...
@@ -107,12 +79,8 @@ scrape_configs:
static_configs:
static_configs:
- targets:
- targets:
{% for host in groups['fluentd'] %}
{% for host in groups['fluentd'] %}
- '{{
host
}}:{{ hostvars[host]['prometheus_fluentd_integration_port'] }}'
- '{{
'api' | kolla_address(host) | put_address_in_context('url')
}}:{{ hostvars[host]['prometheus_fluentd_integration_port'] }}'
{% endfor %}
{% endfor %}
relabel_configs:
- source_labels: [__address__]
regex: "([^:]+):\\d+"
target_label: instance
{% endif %}
{% endif %}
{% if enable_prometheus_ceph_mgr_exporter | bool %}
{% if enable_prometheus_ceph_mgr_exporter | bool %}
...
@@ -123,10 +91,6 @@ scrape_configs:
...
@@ -123,10 +91,6 @@ scrape_configs:
{% for exporter in prometheus_ceph_mgr_exporter_endpoints %}
{% for exporter in prometheus_ceph_mgr_exporter_endpoints %}
- '{{ exporter }}'
- '{{ exporter }}'
{% endfor %}
{% endfor %}
relabel_configs:
- source_labels: [__address__]
regex: "([^:]+):\\d+"
target_label: instance
{% endif %}
{% endif %}
{% if enable_prometheus_openstack_exporter | bool %}
{% if enable_prometheus_openstack_exporter | bool %}
...
@@ -137,12 +101,8 @@ scrape_configs:
...
@@ -137,12 +101,8 @@ scrape_configs:
static_configs:
static_configs:
- targets:
- targets:
{% for host in groups["prometheus-openstack-exporter"] %}
{% for host in groups["prometheus-openstack-exporter"] %}
- '{{
host
}}:{{ hostvars[host]['prometheus_openstack_exporter_port'] }}'
- '{{
'api' | kolla_address(host) | put_address_in_context('url')
}}:{{ hostvars[host]['prometheus_openstack_exporter_port'] }}'
{% endfor %}
{% endfor %}
relabel_configs:
- source_labels: [__address__]
regex: "([^:]+):\\d+"
target_label: instance
{% endif %}
{% endif %}
{% if enable_prometheus_elasticsearch_exporter | bool %}
{% if enable_prometheus_elasticsearch_exporter | bool %}
...
@@ -151,12 +111,8 @@ scrape_configs:
...
@@ -151,12 +111,8 @@ scrape_configs:
static_configs:
static_configs:
- targets:
- targets:
{% for host in groups["prometheus-elasticsearch-exporter"] %}
{% for host in groups["prometheus-elasticsearch-exporter"] %}
- '{{
host
}}:{{ hostvars[host]['prometheus_elasticsearch_exporter_port'] }}'
- '{{
'api' | kolla_address(host) | put_address_in_context('url')
}}:{{ hostvars[host]['prometheus_elasticsearch_exporter_port'] }}'
{% endfor %}
{% endfor %}
relabel_configs:
- source_labels: [__address__]
regex: "([^:]+):\\d+"
target_label: instance
{% endif %}
{% endif %}
{% if enable_prometheus_blackbox_exporter | bool and prometheus_blackbox_exporter_endpoints | length > 0 | bool %}
{% if enable_prometheus_blackbox_exporter | bool and prometheus_blackbox_exporter_endpoints | length > 0 | bool %}
...
@@ -194,18 +150,14 @@ scrape_configs:
...
@@ -194,18 +150,14 @@ scrape_configs:
static_configs:
static_configs:
- targets:
- targets:
{% for host in groups['prometheus-alertmanager'] %}
{% for host in groups['prometheus-alertmanager'] %}
- '{{
host
}}:{{ hostvars[host]['prometheus_alertmanager_port'] }}'
- '{{
'api' | kolla_address(host) | put_address_in_context('url')
}}:{{ hostvars[host]['prometheus_alertmanager_port'] }}'
{% endfor %}
{% endfor %}
relabel_configs:
- source_labels: [__address__]
regex: "([^:]+):\\d+"
target_label: instance
alerting:
alerting:
alertmanagers:
alertmanagers:
- static_configs:
- static_configs:
- targets:
- targets:
{% for host in groups["prometheus-alertmanager"] %}
{% for host in groups["prometheus-alertmanager"] %}
- '{{
host
}}:{{ hostvars[host]['prometheus_alertmanager_port'] }}'
- '{{
'api' | kolla_address(host) | put_address_in_context('url')
}}:{{ hostvars[host]['prometheus_alertmanager_port'] }}'
{% endfor %}
{% endfor %}
{% endif %}
{% endif %}
This diff is collapsed.
Click to expand it.
releasenotes/notes/fix-1955563-42a14bb080e15df2.yaml
0 → 100644
+
9
−
0
View file @
2146015c
---
fixes
:
-
|
Fixes an issue with Prometheus scraping when targets' Ansible inventory
hostnames (``inventory_hostname``) do not resolve to reachable IP
addresses. Reverts to the previous behaviour of using IP addresses to
communicate with targets. The side effect of this is that targets instances
will again be labelled using IP addresses rather than hostnames.
`LP#1955563 <https://bugs.launchpad.net/kolla-ansible/+bug/1955563>`__
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment