mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
#1180 gave web-app-matrix a canonical `jitsi` domain for its own Jitsi and listed it under `services.jitsi.domains`. When Jitsi is shared or disabled nothing serves that domain, and the blackbox healthz job of web-app-prometheus probed every canonical domain, so the probe of https://jitsi.matrix.<domain>/healthz/ready failed with "tls: unrecognized name" and `prometheus scrape: every consumer role reports up=1 and passes its probe` went red (main run 40017166046: Matrix#2, Nextcloud#12). web_health_expectations already skipped such keys. The rule now lives in utils/domains/unserved.py: a key claimed by a service entity that is disabled, or enabled but shared, is not served by that app. The health filter uses it unchanged, and prometheus.yml.j2 filters its targets through the new `served_domains` filter, which also drops the `<key>_onion` mirror of a skipped key. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
75 lines
2.6 KiB
Django/Jinja
75 lines
2.6 KiB
Django/Jinja
# 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') }}"
|