1
0
Fork 0
mirror of https://gitlab.com/s3lph/ansible-collection-prometheus synced 2024-10-23 11:56:59 +02:00
ansible-collection-prometheus/roles/prometheus/templates/prometheus-job.yml

53 lines
1.5 KiB
YAML
Raw Normal View History

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 -%}
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) }}
{% 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 -%}
{%- set fstring = {} -%}
{%- set ignored = fstring.update(job.defaults|default({})) -%}
2020-11-13 10:36:46 +01:00
{%- set ignored = fstring.update(hostvars[host]) -%}
- {{ job.target_format | format(**fstring) }}
{% endif -%}
{% endfor -%}