1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
|
global:
scrape_interval: {{ prometheus_scrape_interval }}
scrape_timeout: 10s
evaluation_interval: 15s
{% if prometheus_external_labels %}
external_labels:
{% for label, value in prometheus_external_labels.items() %}
{{ label }}: {{ value }}
{% endfor %}
{% endif %}
{% if prometheus_alert_rules.files is defined and prometheus_alert_rules.files | length > 0 %}
rule_files:
{% for rule in prometheus_alert_rules.files %}
- "/etc/prometheus/{{ rule.path | basename }}"
{% endfor %}
{% endif %}
scrape_configs:
- job_name: prometheus
basic_auth:
username: admin
password: "{{ prometheus_password }}"
static_configs:
{% for host in groups['prometheus'] %}
- targets:
- '{{ 'api' | kolla_address(host, override_var='prometheus_target_address') | put_address_in_context('url') }}:{{ prometheus_port }}'
{% if hostvars[host].prometheus_instance_label | default(false, true) %}
labels:
instance: "{{ hostvars[host].prometheus_instance_label }}"
{% endif %}
{% endfor %}
{% if enable_prometheus_node_exporter | bool %}
- job_name: node
static_configs:
{% for host in groups['prometheus-node-exporter'] %}
- targets:
- '{{ 'api' | kolla_address(host, override_var='prometheus_target_address') | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_node_exporter_port'] }}'
{% if hostvars[host].prometheus_instance_label | default(false, true) %}
labels:
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 %}
- job_name: mysqld
static_configs:
{% for host in groups['prometheus-mysqld-exporter'] %}
- targets:
- '{{ 'api' | kolla_address(host, override_var='prometheus_target_address') | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_mysqld_exporter_port'] }}'
{% if hostvars[host].prometheus_instance_label | default(false, true) %}
labels:
instance: "{{ hostvars[host].prometheus_instance_label }}"
{% endif %}
{% endfor %}
{% endif %}
{% if enable_prometheus_haproxy_exporter | bool %}
- job_name: haproxy
static_configs:
{% for host in groups['loadbalancer'] %}
- targets:
- '{{ 'api' | kolla_address(host, override_var='prometheus_target_address') | put_address_in_context('url') }}:{{ prometheus_haproxy_exporter_port }}'
{% if hostvars[host].prometheus_instance_label | default(false, true) %}
labels:
instance: "{{ hostvars[host].prometheus_instance_label }}"
{% endif %}
{% endfor %}
{% endif %}
{% if enable_prometheus_rabbitmq_exporter | bool %}
- job_name: rabbitmq
static_configs:
{% for host in groups['rabbitmq'] %}
- targets:
- '{{ 'api' | kolla_address(host, override_var='prometheus_target_address') | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_rabbitmq_exporter_port'] }}'
{% if hostvars[host].prometheus_instance_label | default(false, true) %}
labels:
instance: "{{ hostvars[host].prometheus_instance_label }}"
{% endif %}
{% endfor %}
{% endif %}
{% if enable_prometheus_memcached_exporter | bool %}
- job_name: memcached
static_configs:
{% for host in groups['prometheus-memcached-exporter'] %}
- targets:
- '{{ 'api' | kolla_address(host, override_var='prometheus_target_address') | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_memcached_exporter_port'] }}'
{% if hostvars[host].prometheus_instance_label | default(false, true) %}
labels:
instance: "{{ hostvars[host].prometheus_instance_label }}"
{% endif %}
{% endfor %}
{% endif %}
{% if enable_prometheus_cadvisor | bool %}
- job_name: cadvisor
static_configs:
{% for host in groups["prometheus-cadvisor"] %}
- targets:
- '{{ 'api' | kolla_address(host, override_var='prometheus_target_address') | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_cadvisor_port'] }}'
{% if hostvars[host].prometheus_instance_label | default(false, true) %}
labels:
instance: "{{ hostvars[host].prometheus_instance_label }}"
{% endif %}
{% endfor %}
{% endif %}
{% if enable_prometheus_fluentd_integration | bool %}
- job_name: fluentd
static_configs:
{% for host in groups['fluentd'] %}
- targets:
- '{{ 'api' | kolla_address(host, override_var='prometheus_target_address') | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_fluentd_integration_port'] }}'
{% if hostvars[host].prometheus_instance_label | default(false, true) %}
labels:
instance: "{{ hostvars[host].prometheus_instance_label }}"
{% endif %}
{% endfor %}
{% endif %}
{% if enable_prometheus_ceph_mgr_exporter | bool %}
- job_name: ceph_mgr_exporter
honor_labels: true
scrape_interval: {{ prometheus_ceph_exporter_interval }}
static_configs:
- targets:
{% for exporter in prometheus_ceph_mgr_exporter_endpoints %}
- '{{ exporter }}'
{% endfor %}
{% endif %}
{% if enable_prometheus_openstack_exporter | bool %}
- job_name: openstack_exporter
scrape_interval: {{ prometheus_openstack_exporter_interval }}
scrape_timeout: {{ prometheus_openstack_exporter_timeout }}
{% if kolla_enable_tls_internal | bool %}
scheme: https
{% endif %}
honor_labels: true
static_configs:
- targets:
- '{{ kolla_internal_fqdn | put_address_in_context('url') }}:{{ prometheus_openstack_exporter_port }}'
{% endif %}
{% if enable_prometheus_elasticsearch_exporter | bool %}
- job_name: elasticsearch_exporter
scrape_interval: {{ prometheus_elasticsearch_exporter_interval }}
static_configs:
{% for host in groups["prometheus-elasticsearch-exporter"] %}
- targets:
- '{{ 'api' | kolla_address(host, override_var='prometheus_target_address') | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_elasticsearch_exporter_port'] }}'
{% if hostvars[host].prometheus_instance_label | default(false, true) %}
labels:
instance: "{{ hostvars[host].prometheus_instance_label }}"
{% endif %}
{% endfor %}
{% endif %}
{% if enable_prometheus_blackbox_exporter | bool and prometheus_blackbox_exporter_endpoints | length > 0 | bool %}
- job_name: blackbox_exporter
metrics_path: /probe
honor_labels: true
static_configs:
- targets:
{% for target in prometheus_blackbox_exporter_endpoints %}
- '{{ target }}'
{% endfor %}
relabel_configs:
- source_labels: [__address__]
regex: ([^:]+):([^:]+):(.+)
target_label: service
replacement: ${1}
- source_labels: [__address__]
regex: ([^:]+):([^:]+):(.+)
target_label: __param_module
replacement: ${2}
- source_labels: [__param_module]
target_label: module
- source_labels: [__address__]
regex: ([^:]+):([^:]+):(.+)
target_label: __param_target
replacement: ${3}
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: '{{ api_interface_address | put_address_in_context('url') }}:{{ prometheus_blackbox_exporter_port }}'
{% endif %}
{% if enable_prometheus_libvirt_exporter | bool %}
- job_name: libvirt_exporter
scrape_interval: {{ prometheus_libvirt_exporter_interval }}
honor_labels: true
static_configs:
{% for host in groups["prometheus-libvirt-exporter"] %}
- targets:
- '{{ 'api' | kolla_address(host, override_var='prometheus_target_address') | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_libvirt_exporter_port'] }}'
{% if hostvars[host].prometheus_instance_label | default(false, true) %}
labels:
instance: "{{ hostvars[host].prometheus_instance_label }}"
{% endif %}
{% endfor %}
{% endif %}
{% if enable_prometheus_etcd_integration | bool %}
- job_name: etcd
{% if etcd_enable_tls | bool %}
scheme: https
{% endif %}
static_configs:
{% for host in groups["etcd"] %}
- targets:
- '{{ 'api' | kolla_address(host, override_var='prometheus_target_address') | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_etcd_integration_port'] }}'
{% if hostvars[host].prometheus_instance_label | default(false, true) %}
labels:
instance: "{{ hostvars[host].prometheus_instance_label }}"
{% endif %}
{% endfor %}
{% endif %}
{% if enable_ironic_prometheus_exporter | bool %}
- job_name: ironic_prometheus_exporter
static_configs:
{% for host in groups['ironic-conductor'] %}
- targets:
- '{{ 'api' | kolla_address(host, override_var='prometheus_target_address') | put_address_in_context('url') }}:{{ hostvars[host]['ironic_prometheus_exporter_port'] }}'
{% if hostvars[host].prometheus_instance_label | default(false, true) %}
labels:
instance: "{{ hostvars[host].prometheus_instance_label }}"
{% endif %}
{% endfor %}
{% endif %}
{% if enable_prometheus_alertmanager | bool %}
- job_name: alertmanager
static_configs:
{% for host in groups['prometheus-alertmanager'] %}
- targets:
- '{{ 'api' | kolla_address(host, override_var='prometheus_target_address') | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_alertmanager_port'] }}'
{% if hostvars[host].prometheus_instance_label | default(false, true) %}
labels:
instance: "{{ hostvars[host].prometheus_instance_label }}"
{% endif %}
{% endfor %}
{% if enable_prometheus_proxysql_exporter | bool %}
- job_name: proxysql
static_configs:
{% for host in groups["loadbalancer"] %}
- targets:
- '{{ 'api' | kolla_address(host, override_var='prometheus_target_address') | put_address_in_context('url') }}:{{ hostvars[host]['proxysql_prometheus_exporter_port'] }}'
{% if hostvars[host].prometheus_instance_label | default(false, true) %}
labels:
instance: "{{ hostvars[host].prometheus_instance_label }}"
{% endif %}
{% endfor %}
{% endif %}
alerting:
alertmanagers:
- static_configs:
{% for host in groups["prometheus-alertmanager"] %}
- targets:
- '{{ 'api' | kolla_address(host, override_var='prometheus_target_address') | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_alertmanager_port'] }}'
{% if hostvars[host].prometheus_instance_label | default(false, true) %}
labels:
instance: "{{ hostvars[host].prometheus_instance_label }}"
{% endif %}
{% endfor %}
{% endif %}
|