feat: Add Alertmanager configuration with severity-based routing and multi-channel notifications

- Add global configuration with 5m resolve timeout and Slack webhook URL placeholder
- Add template directory reference for custom alert notification templates
- Add route configuration with grouping by alertname, severity, and service (10s wait/interval, 12h repeat)
- Add severity-based routing (critical, warning, info) with dedicated receivers
- Add default Slack receiver for #telecom-platform-alerts channel
This commit is contained in:
nutcas3
2026-04-25 05:34:01 +03:00
parent bd3226edf0
commit c3903238dc
+124
View File
@@ -0,0 +1,124 @@
global:
resolve_timeout: 5m
# Slack webhook URL (replace with actual webhook)
slack_api_url: 'https://hooks.slack.com/services/YOUR/WEBHOOK/URL'
# Templates for alert notifications
templates:
- '/etc/alertmanager/templates/*.tmpl'
# Route configuration
route:
group_by: ['alertname', 'severity', 'service']
group_wait: 10s
group_interval: 10s
repeat_interval: 12h
receiver: 'default'
routes:
# Critical alerts go to critical receiver
- match:
severity: critical
receiver: 'critical'
continue: false
# Warning alerts go to warning receiver
- match:
severity: warning
receiver: 'warning'
continue: false
# Info alerts go to info receiver
- match:
severity: info
receiver: 'info'
continue: false
# Receivers configuration
receivers:
- name: 'default'
slack_configs:
- channel: '#telecom-platform-alerts'
send_resolved: true
title: '{{ .GroupLabels.alertname }}'
text: >-
{{ range .Alerts }}
Alert: {{ .Labels.alertname }}
Severity: {{ .Labels.severity }}
Service: {{ .Labels.service }}
Description: {{ .Annotations.description }}
{{ end }}
- name: 'critical'
slack_configs:
- channel: '#telecom-platform-critical'
send_resolved: true
title: '🚨 CRITICAL: {{ .GroupLabels.alertname }}'
color: 'danger'
text: >-
{{ range .Alerts }}
Alert: {{ .Labels.alertname }}
Severity: {{ .Labels.severity }}
Service: {{ .Labels.service }}
Description: {{ .Annotations.description }}
{{ end }}
# Email configuration for critical alerts
email_configs:
- to: '[email protected]'
from: '[email protected]'
headers:
Subject: '🚨 CRITICAL: {{ .GroupLabels.alertname }}'
html: >-
{{ range .Alerts }}
<h3>{{ .Labels.alertname }}</h3>
<p><strong>Severity:</strong> {{ .Labels.severity }}</p>
<p><strong>Service:</strong> {{ .Labels.service }}</p>
<p><strong>Description:</strong> {{ .Annotations.description }}</p>
<hr>
{{ end }}
- name: 'warning'
slack_configs:
- channel: '#telecom-platform-warnings'
send_resolved: true
title: '⚠️ WARNING: {{ .GroupLabels.alertname }}'
color: 'warning'
text: >-
{{ range .Alerts }}
Alert: {{ .Labels.alertname }}
Severity: {{ .Labels.severity }}
Service: {{ .Labels.service }}
Description: {{ .Annotations.description }}
{{ end }}
- name: 'info'
slack_configs:
- channel: '#telecom-platform-info'
send_resolved: true
title: 'ℹ️ INFO: {{ .GroupLabels.alertname }}'
color: 'good'
text: >-
{{ range .Alerts }}
Alert: {{ .Labels.alertname }}
Severity: {{ .Labels.severity }}
Service: {{ .Labels.service }}
Description: {{ .Annotations.description }}
{{ end }}
# Inhibition rules
inhibit_rules:
# If a critical alert is firing, inhibit warnings for the same service
- source_match:
severity: 'critical'
target_match:
severity: 'warning'
equal: ['service']
target_match_re:
alertname: '.*'
# If a service is down, inhibit other alerts for that service
- source_match:
alertname: '.*Down'
target_match_re:
alertname: '.*'
equal: ['service']