Dateien
Hetzner-Backup/monitoring/alertmanager/alertmanager.yml
2025-06-18 23:22:38 +02:00

94 Zeilen
2.2 KiB
YAML

global:
resolve_timeout: 5m
smtp_from: 'alerts@v2-docker.com'
smtp_smarthost: 'smtp.gmail.com:587'
smtp_auth_username: '${SMTP_USERNAME}'
smtp_auth_password: '${SMTP_PASSWORD}'
smtp_require_tls: true
# Templates for notifications
templates:
- '/etc/alertmanager/templates/*.tmpl'
# Route tree
route:
group_by: ['alertname', 'cluster', 'service']
group_wait: 10s
group_interval: 10s
repeat_interval: 12h
receiver: 'default'
routes:
# Critical alerts
- match:
severity: critical
receiver: 'critical'
continue: true
# License abuse alerts
- match:
alertname: PossibleLicenseAbuse
receiver: 'security'
repeat_interval: 1h
# Database alerts
- match:
service: postgres
receiver: 'database'
# Infrastructure alerts
- match_re:
alertname: ^(HighCPUUsage|HighMemoryUsage|LowDiskSpace)$
receiver: 'infrastructure'
# Receivers
receivers:
- name: 'default'
email_configs:
- to: 'admin@v2-docker.com'
headers:
Subject: '[{{ .Status | toUpper }}] {{ .GroupLabels.alertname }}'
html: |
<h2>Alert: {{ .GroupLabels.alertname }}</h2>
<p><b>Status:</b> {{ .Status }}</p>
{{ range .Alerts }}
<hr>
<p><b>Summary:</b> {{ .Annotations.summary }}</p>
<p><b>Description:</b> {{ .Annotations.description }}</p>
<p><b>Labels:</b></p>
<ul>
{{ range .Labels.SortedPairs }}
<li><b>{{ .Name }}:</b> {{ .Value }}</li>
{{ end }}
</ul>
{{ end }}
- name: 'critical'
email_configs:
- to: 'critical-alerts@v2-docker.com'
send_resolved: true
webhook_configs:
- url: '${WEBHOOK_CRITICAL}'
send_resolved: true
- name: 'security'
email_configs:
- to: 'security@v2-docker.com'
webhook_configs:
- url: '${WEBHOOK_SECURITY}'
- name: 'database'
email_configs:
- to: 'dba@v2-docker.com'
- name: 'infrastructure'
email_configs:
- to: 'ops@v2-docker.com'
# Inhibition rules
inhibit_rules:
- source_match:
severity: 'critical'
target_match:
severity: 'warning'
equal: ['alertname', 'instance']