--- # {{ ansible_managed }} global: scrape_interval: 10s evaluation_interval: 10s # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. rule_files: - "/etc/prometheus/recording/*.yaml" - "/etc/prometheus/alerting/*.yaml" scrape_configs: - job_name: prometheus static_configs: - targets: - localhost:9090 - job_name: blackbox static_configs: - targets: - blackbox-exporter:9115 - job_name: node static_configs: - targets: - host.containers.internal:9100 {% if prometheus_ping_hosts | length > 0 %} - job_name: "icmp" metrics_path: "/probe" params: module: ["icmp"] static_configs: - targets: {% for host in prometheus_ping_hosts %} - "{{ host.name }}::{{ host.type | default('monitored') }}" {% endfor %} relabel_configs: - source_labels: - __address__ regex: '(.+)::(.+)' target_label: __param_target replacement: '${1}' - source_labels: - __address__ regex: '(.+)::(.+)' target_label: host_type replacement: '${2}' - source_labels: - __param_target target_label: instance - target_label: __address__ replacement: blackbox_exporter:9115 {%- endif %}