mirror of
https://gitlab.com/s3lph/ansible-collection-prometheus
synced 2024-11-22 09:41:01 +01:00
52 lines
1.5 KiB
YAML
52 lines
1.5 KiB
YAML
|
|
- 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 -%}
|
|
|
|
{% if 'tls_config' in job -%}
|
|
tls_config:
|
|
ca_file: {{ job.tls_config.ca_file }}
|
|
cert_file: {{ job.tls_config.cert_file }}
|
|
key_file: {{ job.tls_config.key_file }}
|
|
insecure_skip_verify: {{ job.tls_config.insecure_skip_verify | default(false) }}
|
|
{% endif -%}
|
|
|
|
static_configs:
|
|
- targets:
|
|
{% for host in groups['all'] -%}
|
|
{% if hostvars[host]['monitor_' + job.name] | default(false) | bool -%}
|
|
{%- set fstring = {} -%}
|
|
{%- set ignored = fstring.update(job.defaults|default({})) -%}
|
|
{%- set ignored = fstring.update(hostvars[host]) -%}
|
|
- {{ job.target_format | format(**fstring) | format(**fstring) }}
|
|
{% endif -%}
|
|
{% endfor -%}
|
|
|