# Prometheus scrape configuration — auto-generated by Ansible # DO NOT edit manually; this Jinja2 template IS the source. global: scrape_interval: 30s evaluation_interval: 30s external_labels: environment: "{{ DOMAIN_PRIMARY }}" alerting: alertmanagers: - static_configs: - targets: ["{{ lookup('scrape_target', application_id, 'alertmanager') }}"] rule_files: - "{{ ALERT_RULES_CONFIG_DOCKER }}" scrape_configs: - job_name: "prometheus" static_configs: - targets: ["localhost:9090"] - job_name: "nginx-metricz" scheme: {{ lookup('tls', application_id, 'protocols.web') }} metrics_path: /metricz tls_config: insecure_skip_verify: {{ not (lookup('tls', application_id, 'enabled') | bool) }} static_configs: - targets: ["{{ lookup('domain', application_id) }}"] - job_name: "cadvisor" static_configs: - targets: ["{{ lookup('scrape_target', application_id, 'cadvisor') }}"] - job_name: "node-exporter" static_configs: - targets: ["{{ lookup('scrape_target', application_id, 'node-exporter', compose_host='host.docker.internal') }}"] {% for native_prometheus_application_id in lookup('native_metrics_apps') %} {% include 'roles/' + native_prometheus_application_id + '/templates/prometheus.yml.j2' %} {% endfor %} {% set canonical_map = lookup('domains') %} {% set probed_roles = lookup('roles_with_service', 'prometheus') | map(attribute='id') | list %} {% set private_ca_unverifiable = not lookup('ca_injected', application_id) %} - job_name: "blackbox-healthz" metrics_path: /probe params: module: [http_ready] static_configs: {% for _application_id in CURRENT_PLAY_APPLICATIONS | list | sort %} {% if _application_id in probed_roles %} {% set canonical_probe_domains = canonical_map.get(_application_id, []) | served_domains(lookup('config', _application_id, 'services')) %} {% if canonical_probe_domains | length > 0 %} - targets: {% for domain in canonical_probe_domains %} - "{{ lookup('tls', domain, 'url.base') }}healthz/ready" {% endfor %} labels: app: "{{ _application_id }}" {% if private_ca_unverifiable and lookup('tls', _application_id, 'mode') == 'self_signed' %} __param_module: http_ready_private_ca {% endif %} {% endif %} {% endif %} {% endfor %} relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: "{{ lookup('scrape_target', application_id, 'blackbox-exporter') }}"