feat(monitoring): add Alertmanager with Slack notifications

- config/alertmanager/alertmanager.yml: route, slack-default and null receivers
- config/prometheus.yml: alerting.alertmanagers -> alertmanager:9093
- docker-compose.prod.yml: alertmanager service (port 9093)
This commit is contained in:
senke 2026-02-23 19:54:55 +01:00
parent c002e74031
commit 30bc31f3a6
3 changed files with 49 additions and 0 deletions

View file

@ -0,0 +1,24 @@
# Alertmanager config for Veza
# For Slack: override this file with your SLACK_WEBHOOK_URL in api_url
global:
resolve_timeout: 5m
route:
receiver: 'null'
group_by: ['alertname', 'job']
group_wait: 30s
group_interval: 5m
repeat_interval: 4h
receivers:
- name: 'slack-default'
slack_configs:
- api_url: '${SLACK_WEBHOOK_URL}'
channel: '#alerts'
send_resolved: true
title: '{{ .Status | toUpper }}: {{ .GroupLabels.alertname }}'
text: '{{ range .Alerts }}{{ .Annotations.description }}{{ end }}'
- name: 'null'
# Default: alerts received but not sent. Set route.receiver to slack-default
# and SLACK_WEBHOOK_URL env when Slack is configured.

View file

@ -2,6 +2,11 @@ global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets: ['alertmanager:9093']
rule_files:
- "prometheus/alert_rules.yml"

View file

@ -337,6 +337,26 @@ services:
networks:
- veza-network
# ============================================================================
# MONITORING - Alertmanager
# Set SLACK_WEBHOOK_URL for Slack notifications. Works with Prometheus.
# ============================================================================
alertmanager:
image: prom/alertmanager:v0.26.0
container_name: veza_alertmanager
restart: unless-stopped
ports:
- "9093:9093"
volumes:
- ./config/alertmanager/alertmanager.yml:/etc/alertmanager/alertmanager.yml:ro
command:
- '--config.file=/etc/alertmanager/alertmanager.yml'
- '--storage.path=/alertmanager'
environment:
- SLACK_WEBHOOK_URL=${SLACK_WEBHOOK_URL:-}
networks:
- veza-network
web-blue:
build:
context: ./apps/web