Some checks failed
deploy / ansible (push) Failing after 41s
The VPC ping sweep misses a server that drops ICMP or is not attached to the private network. Prometheus now lists the project's servers from the Hetzner API with a read-only token and marks each one known or not against monitoring_hcloud_servers. Nothing is scraped from the servers: every discovered target is Prometheus itself with all samples dropped, which leaves one `up` series per server. A second alert fires when the list stops updating, so a revoked token does not silently disable the check. Assisted-by: Claude:fable-5-2
109 lines
3.3 KiB
Django/Jinja
109 lines
3.3 KiB
Django/Jinja
# Managed by Ansible (role monitoring).
|
|
global:
|
|
scrape_interval: 30s
|
|
evaluation_interval: 30s
|
|
|
|
scrape_configs:
|
|
- job_name: node
|
|
static_configs:
|
|
{% for h in monitoring_hosts %}
|
|
- targets: ["{{ h.address }}:{{ monitoring_node_exporter_port }}"]
|
|
labels: { host: {{ h.name }} }
|
|
{% endfor %}
|
|
|
|
- job_name: cadvisor
|
|
scrape_interval: 60s
|
|
static_configs:
|
|
{% for h in monitoring_hosts %}
|
|
- targets: ["{{ h.address }}:{{ monitoring_cadvisor_port }}"]
|
|
labels: { host: {{ h.name }} }
|
|
{% endfor %}
|
|
metric_relabel_configs:
|
|
# Short-lived CI job containers would bloat the series count
|
|
- source_labels: [name]
|
|
regex: FORGEJO-ACTIONS-TASK-.*
|
|
action: drop
|
|
|
|
- job_name: alloy
|
|
static_configs:
|
|
{% for h in monitoring_hosts %}
|
|
- targets: ["{{ h.address }}:12345"]
|
|
labels: { host: {{ h.name }} }
|
|
{% endfor %}
|
|
|
|
- job_name: traefik
|
|
static_configs:
|
|
- targets: ["traefik:8082"]
|
|
labels: { host: asxpio-ops }
|
|
|
|
- job_name: forgejo
|
|
metrics_path: /metrics
|
|
authorization:
|
|
credentials: "{{ monitoring_forgejo_metrics_token }}"
|
|
static_configs:
|
|
- targets: ["forgejo:3000"]
|
|
labels: { host: asxpio-ops }
|
|
|
|
- job_name: postgres
|
|
static_configs:
|
|
- targets: ["postgres-exporter:9187"]
|
|
labels: { host: asxpio-ops }
|
|
|
|
- job_name: monitoring
|
|
static_configs:
|
|
- targets: ["localhost:9090", "loki:3100", "grafana:3000", "blackbox:9115"]
|
|
labels: { host: asxpio-ops }
|
|
|
|
# Servers in the Hetzner project, from the API (read-only token). Nothing
|
|
# is scraped from them: every target is Prometheus itself with all
|
|
# samples dropped, which leaves one `up` series per server.
|
|
- job_name: hcloud
|
|
scrape_interval: 60s
|
|
hetzner_sd_configs:
|
|
- role: hcloud
|
|
authorization:
|
|
credentials: "{{ monitoring_hcloud_token }}"
|
|
relabel_configs:
|
|
- source_labels: [__meta_hetzner_server_name]
|
|
target_label: server
|
|
- source_labels: [__meta_hetzner_server_name]
|
|
target_label: instance
|
|
- source_labels: [__meta_hetzner_public_ipv4]
|
|
target_label: public_ip
|
|
- regex: __meta_hetzner_hcloud_private_ipv4_.+
|
|
action: labelmap
|
|
replacement: private_ip
|
|
- source_labels: [__meta_hetzner_hcloud_server_type]
|
|
target_label: type
|
|
- source_labels: [__meta_hetzner_server_status]
|
|
target_label: status
|
|
- target_label: known
|
|
replacement: "false"
|
|
- source_labels: [__meta_hetzner_server_name]
|
|
regex: '{{ monitoring_hcloud_servers | map("regex_escape") | join("|") }}'
|
|
target_label: known
|
|
replacement: "true"
|
|
- target_label: __address__
|
|
replacement: localhost:9090
|
|
metric_relabel_configs:
|
|
- action: drop
|
|
|
|
{% for module in monitoring_probes | map(attribute='module') | unique %}
|
|
- job_name: probe_{{ module }}
|
|
metrics_path: /probe
|
|
params:
|
|
module: [{{ module }}]
|
|
static_configs:
|
|
{% for p in monitoring_probes if p.module == module %}
|
|
- targets: ["{{ p.target }}"]
|
|
labels: { probe: "{{ p.name }}" }
|
|
{% endfor %}
|
|
relabel_configs:
|
|
- source_labels: [__address__]
|
|
target_label: __param_target
|
|
- source_labels: [__param_target]
|
|
target_label: instance
|
|
- target_label: __address__
|
|
replacement: blackbox:9115
|
|
|
|
{% endfor %}
|