# Alertmanager Configuration for Homelab
# Routes alerts to both ntfy (via bridge) and Signal

global:
  resolve_timeout: 5m

route:
  group_by: ['alertname', 'severity', 'instance']
  group_wait: 30s
  group_interval: 5m
  repeat_interval: 4h
  receiver: 'ntfy-all'

  routes:
    # Critical alerts go to both Signal AND ntfy
    - match:
        severity: critical
      receiver: 'critical-alerts'
      continue: false

    # Warning alerts go to ntfy only
    - match:
        severity: warning
      receiver: 'ntfy-all'

receivers:
  # ntfy receiver for all alerts (via bridge for nice formatting)
  - name: 'ntfy-all'
    webhook_configs:
      - url: 'http://ntfy-bridge:5001/alert'
        send_resolved: true

  # Critical alerts: Signal + ntfy
  - name: 'critical-alerts'
    webhook_configs:
      # ntfy via bridge (formatted nicely)
      - url: 'http://ntfy-bridge:5001/alert'
        send_resolved: true

      # Signal via bridge service
      - url: 'http://signal-bridge:5000/alert'
        send_resolved: true

inhibit_rules:
  - source_match:
      severity: 'critical'
    target_match:
      severity: 'warning'
    equal: ['alertname', 'instance']
