# Alertmanager Configuration for Homelab
# Routes alerts to both ntfy 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
  - name: 'ntfy-all'
    webhook_configs:
      - url: 'http://NTFY:80/homelab-alerts'
        send_resolved: true
        http_config:
          follow_redirects: true
        max_alerts: 10

  # Critical alerts: Signal + ntfy
  - name: 'critical-alerts'
    webhook_configs:
      # ntfy for critical
      - url: 'http://NTFY:80/homelab-alerts'
        send_resolved: true
        http_config:
          follow_redirects: true
        max_alerts: 5

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

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