2020-11-13 10:36:46 +01:00
|
|
|
|
|
|
|
- job_name: {{ job.name }}
|
|
|
|
{% if 'scrape_interval' in job -%}
|
|
|
|
scrape_interval: {{ job.scrape_interval }}
|
|
|
|
{% endif -%}
|
|
|
|
{% if 'blackbox' in job -%}
|
|
|
|
metrics_path: /probe
|
|
|
|
relabel_configs:
|
|
|
|
- source_labels:
|
|
|
|
- __address__
|
|
|
|
target_label: __param_target
|
|
|
|
- source_labels:
|
|
|
|
- __param_target
|
|
|
|
target_label: instance
|
|
|
|
- target_label: __address__
|
|
|
|
replacement: localhost:9115
|
|
|
|
params:
|
|
|
|
module:
|
|
|
|
{% for module in job.blackbox.modules -%}
|
|
|
|
- {{ module }}
|
|
|
|
{%- endfor %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if 'scheme' in job -%}
|
|
|
|
scheme: {{ job.scheme }}
|
|
|
|
{% endif -%}
|
|
|
|
|
|
|
|
{% if 'basic_auth_user' in job and 'basic_auth_password' in job -%}
|
|
|
|
basic_auth:
|
|
|
|
username: {{ job.basic_auth_user }}
|
|
|
|
password: {{ job.basic_auth_password }}
|
|
|
|
{% endif -%}
|
|
|
|
|
2020-11-18 00:36:11 +01:00
|
|
|
{% if 'tls_config' in job -%}
|
2020-11-17 23:56:43 +01:00
|
|
|
tls_config:
|
2020-11-18 00:04:08 +01:00
|
|
|
ca_file: {{ job.tls_config.ca_file }}
|
|
|
|
cert_file: {{ job.tls_config.cert_file }}
|
|
|
|
key_file: {{ job.tls_config.key_file }}
|
2020-11-18 00:36:11 +01:00
|
|
|
insecure_skip_verify: {{ job.tls_config.insecure_skip_verify | default(false) }}
|
2020-11-17 23:56:43 +01:00
|
|
|
{% endif -%}
|
|
|
|
|
2020-11-13 10:36:46 +01:00
|
|
|
static_configs:
|
|
|
|
- targets:
|
|
|
|
{% for host in groups['all'] -%}
|
|
|
|
{% if hostvars[host]['monitor_' + job.name] | default(false) | bool -%}
|
2021-01-15 21:51:23 +01:00
|
|
|
{%- set fstring = {} -%}
|
|
|
|
{%- set ignored = fstring.update(job.defaults|default({})) -%}
|
2020-11-13 10:36:46 +01:00
|
|
|
{%- set ignored = fstring.update(hostvars[host]) -%}
|
2021-02-20 22:41:31 +01:00
|
|
|
- {{ job.target_format | format(**fstring) | format(**fstring) }}
|
2020-11-13 10:36:46 +01:00
|
|
|
{% endif -%}
|
|
|
|
{% endfor -%}
|
|
|
|
|