# ==============================================================================
# ADTLAS DAI MANAGEMENT SYSTEM - ALERTMANAGER CONFIGURATION
# ==============================================================================
#
# This file configures Alertmanager for the Adtlas DAI Management System,
# handling alert routing, grouping, inhibition, and notification delivery.
#
# Features:
# - Multi-channel notification routing
# - Alert grouping and deduplication
# - Escalation policies
# - Maintenance mode support
# - Security event handling
# - Business hours routing
#
# Author: Adtlas Development Team
# Version: 2.0.0
# Last Updated: 2025-01-20
# ==============================================================================

# ==============================================================================
# GLOBAL CONFIGURATION
# ==============================================================================

global:
  # SMTP server configuration for email notifications
  smtp_smarthost: '${SMTP_HOST}:${SMTP_PORT}'
  smtp_from: '${ALERT_EMAIL_FROM}'
  smtp_auth_username: '${SMTP_USERNAME}'
  smtp_auth_password: '${SMTP_PASSWORD}'
  smtp_require_tls: true
  
  # Global notification templates
  smtp_hello: 'adtlas.com'
 
  # HTTP configuration
  http_config:
    tls_config:
      insecure_skip_verify: false
  
  # Resolve timeout - how long to wait before marking alert as resolved
  resolve_timeout: 5m

# ==============================================================================
# TEMPLATES
# ==============================================================================

templates:
  - '/etc/alertmanager/templates/*.tmpl'

# ==============================================================================
# ROUTE CONFIGURATION
# ==============================================================================

# Root route - all alerts start here
route:
  # Default grouping - group alerts by alertname and cluster
  group_by: ['alertname', 'cluster', 'service']
  
  # How long to wait before sending initial notification
  group_wait: 30s
  
  # How long to wait before sending notification about new alerts
  # that are added to a group of alerts for which notification was already sent
  group_interval: 5m
  
  # How long to wait before re-sending notification if it hasn't been resolved
  repeat_interval: 4h
  
  # Default receiver for all alerts
  receiver: 'adtlas-default'
  
  # Child routes for specific alert types
  routes:
    # ==============================================================================
    # CRITICAL ALERTS - IMMEDIATE ESCALATION
    # ==============================================================================
    
    # Critical system alerts - immediate Email
    - match:
        severity: critical
      receiver: 'adtlas-critical'
      group_wait: 10s
      group_interval: 2m
      repeat_interval: 30m
      routes:
        # Business hours - escalate to on-call team
        - match_re:
            time: '^(Mon|Tue|Wed|Thu|Fri) (0[9-9]|1[0-7]):.*'
          receiver: 'adtlas-critical-business-hours'
        # After hours - escalate to senior on-call
        - receiver: 'adtlas-critical-after-hours'
    
    # ==============================================================================
    # SECURITY ALERTS - SPECIAL HANDLING
    # ==============================================================================
    
    # Security events - route to security team
    - match:
        security_event: "true"
      receiver: 'adtlas-security'
      group_by: ['alertname', 'instance']
      group_wait: 15s
      group_interval: 1m
      repeat_interval: 1h
    
    # ==============================================================================
    # BUSINESS LOGIC ALERTS
    # ==============================================================================
    
    # High business impact alerts
    - match:
        business_impact: critical
      receiver: 'adtlas-business-critical'
      group_wait: 20s
      group_interval: 3m
      repeat_interval: 1h
    
    # Medium business impact alerts
    - match:
        business_impact: high
      receiver: 'adtlas-business-high'
      group_wait: 1m
      group_interval: 5m
      repeat_interval: 2h
    
    # ==============================================================================
    # SERVICE-SPECIFIC ROUTING
    # ==============================================================================
    
    # Database alerts - route to DBA team
    - match_re:
        component: '(postgresql|redis|database).*'
      receiver: 'adtlas-database'
      group_by: ['alertname', 'instance', 'database']
      repeat_interval: 2h
    
    # Infrastructure alerts - route to DevOps team
    - match_re:
        component: '(infrastructure|network|storage|load-balancer).*'
      receiver: 'adtlas-infrastructure'
      group_by: ['alertname', 'instance']
      repeat_interval: 2h
    
    # Application alerts - route to development team
    - match_re:
        service: '(adtlas|django).*'
      receiver: 'adtlas-application'
      group_by: ['alertname', 'service', 'component']
      repeat_interval: 2h
    
    # Monitoring system alerts - route to platform team
    - match:
        service: monitoring
      receiver: 'adtlas-monitoring'
      group_by: ['alertname', 'component']
      repeat_interval: 1h
    
    # ==============================================================================
    # MAINTENANCE AND TESTING
    # ==============================================================================
    
    # Maintenance mode - suppress non-critical alerts
    - match:
        maintenance: "true"
      receiver: 'adtlas-maintenance'
      group_wait: 5m
      group_interval: 30m
      repeat_interval: 24h
    
    # Test alerts - route to development team only
    - match:
        environment: test
      receiver: 'adtlas-test'
      group_wait: 2m
      group_interval: 10m
      repeat_interval: 6h

# ==============================================================================
# INHIBITION RULES
# ==============================================================================

# Inhibition rules suppress alerts when other alerts are firing
inhibit_rules:
  # Suppress warning alerts when critical alerts are firing for the same service
  - source_match:
      severity: 'critical'
    target_match:
      severity: 'warning'
    equal: ['service', 'instance']
  
  # Suppress individual service alerts when entire cluster is down
  - source_match:
      alertname: 'AdtlasClusterDown'
    target_match_re:
      alertname: 'Adtlas.*Down'
    equal: ['cluster']
  
  # Suppress application alerts when database is down
  - source_match_re:
      alertname: 'Adtlas.*DatabaseDown'
    target_match_re:
      alertname: 'Adtlas.*Application.*'
    equal: ['cluster']
  
  # Suppress high error rate alerts when service is down
  - source_match_re:
      alertname: '.*Down'
    target_match_re:
      alertname: '.*High.*Rate'
    equal: ['service', 'instance']
  
  # Suppress memory alerts when OOM killer is active
  - source_match:
      alertname: 'AdtlasContainerOOMKilled'
    target_match_re:
      alertname: '.*Memory.*'
    equal: ['instance', 'container']

# ==============================================================================
# RECEIVERS CONFIGURATION
# ==============================================================================

receivers:
  # ==============================================================================
  # DEFAULT RECEIVER
  # ==============================================================================
  
  - name: 'adtlas-default'
    email_configs:
      - to: '${ALERT_EMAIL_DEFAULT}'
        html: |
          <h2>Adtlas Alert Notification</h2>
          {{ range .Alerts }}
          <div style="border: 1px solid #ccc; padding: 10px; margin: 10px 0;">
            <h3>{{ .Annotations.summary }}</h3>
            <p><strong>Description:</strong> {{ .Annotations.description }}</p>
            <p><strong>Severity:</strong> {{ .Labels.severity }}</p>
            <p><strong>Service:</strong> {{ .Labels.service }}</p>
            <p><strong>Instance:</strong> {{ .Labels.instance }}</p>
            <p><strong>Started:</strong> {{ .StartsAt.Format "2006-01-02 15:04:05" }}</p>
            {{ if .Annotations.runbook_url }}
            <p><strong>Runbook:</strong> <a href="{{ .Annotations.runbook_url }}">{{ .Annotations.runbook_url }}</a></p>
            {{ end }}
          </div>
          {{ end }}
        headers:
          From: '${ALERT_EMAIL_DEFAULT}'
          Subject: '[Adtlas] {{ .GroupLabels.alertname }} - {{ .GroupLabels.severity }}'
          To: '${ALERT_EMAIL_DEFAULT}'
          X-Adtlas-Alert: 'true'
          X-Priority: 'normal'
  
  # ==============================================================================
  # CRITICAL ALERTS
  # ==============================================================================
  
  - name: 'adtlas-critical'
    # Email notification for critical alerts
    email_configs:
      - to: '${ALERT_EMAIL_CRITICAL}'
        html: |
          <h2 style="color: red;">🚨 CRITICAL ALERT DETECTED 🚨</h2>
          
          {{ range .Alerts }}
          <div style="border: 2px solid red; padding: 15px; margin: 10px 0; background-color: #fff5f5;">
            <h3 style="color: red;">{{ .Annotations.summary }}</h3>
            <p><strong>Description:</strong> {{ .Annotations.description }}</p>
            <p><strong>Severity:</strong> <span style="color: red; font-weight: bold;">{{ .Labels.severity }}</span></p>
            <p><strong>Service:</strong> {{ .Labels.service }}</p>
            <p><strong>Component:</strong> {{ .Labels.component }}</p>
            <p><strong>Instance:</strong> {{ .Labels.instance }}</p>
            <p><strong>Started:</strong> {{ .StartsAt.Format "2006-01-02 15:04:05" }}</p>
            {{ if .Annotations.business_impact }}
            <p><strong>Business Impact:</strong> <span style="color: red;">{{ .Annotations.business_impact }}</span></p>
            {{ end }}
            {{ if .Annotations.runbook_url }}
            <p><strong>Runbook:</strong> <a href="{{ .Annotations.runbook_url }}">{{ .Annotations.runbook_url }}</a></p>
            {{ end }}
          </div>
          {{ end }}
          
          <p style="color: red; font-weight: bold;">
            This is a critical alert requiring immediate attention.<br>
            Please follow the runbook procedures and escalate if necessary.
          </p>
        headers:
          From: '${ALERT_EMAIL_DEFAULT}'
          Subject: '🚨 [CRITICAL] Adtlas Alert: {{ .GroupLabels.alertname }}'
          To: '${ALERT_EMAIL_CRITICAL}'
          X-Adtlas-Alert: 'true' 
          X-Priority: 'urgent'
  
  # Business hours critical alerts
  - name: 'adtlas-critical-business-hours' 
    email_configs:
      - to: '${ALERT_EMAIL_CRITICAL_BUSINESS_HOURS}'
        html: |
          <h2 style="color: red;">🚨 CRITICAL ALERT DETECTED (Business Hours) 🚨</h2>
          
          {{ range .Alerts }}
          <div style="border: 2px solid red; padding: 15px; margin: 10px 0; background-color: #fff5f5;">
            <h3 style="color: red;">{{ .Annotations.summary }}</h3>
            <p><strong>Description:</strong> {{ .Annotations.description }}</p>
            <p><strong>Severity:</strong> <span style="color: red; font-weight: bold;">{{ .Labels.severity }}</span></p>
            <p><strong>Service:</strong> {{ .Labels.service }}</p>
            <p><strong>Component:</strong> {{ .Labels.component }}</p>
            <p><strong>Instance:</strong> {{ .Labels.instance }}</p>
            <p><strong>Started:</strong> {{ .StartsAt.Format "2006-01-02 15:04:05" }}</p>
            {{ if .Annotations.business_impact }}
            <p><strong>Business Impact:</strong> <span style="color: red;">{{ .Annotations.business_impact }}</span></p>
            {{ end }}
            {{ if .Annotations.runbook_url }}
            <p><strong>Runbook:</strong> <a href="{{ .Annotations.runbook_url }}">{{ .Annotations.runbook_url }}</a></p>
            {{ end }}
          </div>
          {{ end }}
          
          <p style="color: red; font-weight: bold;">
            This is a critical alert requiring immediate attention.<br>
            Please follow the runbook procedures and escalate if necessary.
          </p>
        headers:
          From: '${ALERT_EMAIL_DEFAULT}'
          Subject: '🚨 [CRITICAL] Adtlas Alert: {{ .GroupLabels.alertname }}'
          To: '${ALERT_EMAIL_CRITICAL_AFTER_HOURS}'
          X-Adtlas-Alert: 'true'
          X-Priority: 'urgent'
  
  # After hours critical alerts
  - name: 'adtlas-critical-after-hours'
    email_configs:
      - to: '${ALERT_EMAIL_CRITICAL_AFTER_HOURS}'
        html: |
          <h2 style="color: red;">🚨 CRITICAL ALERT DETECTED (After Hours) 🚨</h2>
          
          {{ range .Alerts }}
          <div style="border: 2px solid red; padding: 15px; margin: 10px 0; background-color: #fff5f5;">
            <h3 style="color: red;">{{ .Annotations.summary }}</h3>
            <p><strong>Description:</strong> {{ .Annotations.description }}</p>
            <p><strong>Severity:</strong> <span style="color: red; font-weight: bold;">{{ .Labels.severity }}</span></p>
            <p><strong>Service:</strong> {{ .Labels.service }}</p>
            <p><strong>Component:</strong> {{ .Labels.component }}</p>
            <p><strong>Instance:</strong> {{ .Labels.instance }}</p>
            <p><strong>Started:</strong> {{ .StartsAt.Format "2006-01-02 15:04:05" }}</p>
            {{ if .Annotations.business_impact }}
            <p><strong>Business Impact:</strong> <span style="color: red;">{{ .Annotations.business_impact }}</span></p>
            {{ end }}
            {{ if .Annotations.runbook_url }}
            <p><strong>Runbook:</strong> <a href="{{ .Annotations.runbook_url }}">{{ .Annotations.runbook_url }}</a></p>
            {{ end }}
          </div>
          {{ end }}
          <p style="color: red; font-weight: bold;">
            This is a critical alert requiring immediate attention.<br>
            Please follow the runbook procedures and escalate if necessary.
          </p>
        headers:
          From: '${ALERT_EMAIL_DEFAULT}'
          subject: '🚨 [CRITICAL] Adtlas Alert: {{ .GroupLabels.alertname }}'
          To: '${ALERT_EMAIL_CRITICAL_AFTER_HOURS}'
          X-Adtlas-Alert: 'true'
          X-Priority: 'urgent'
  
  # ==============================================================================
  # SECURITY ALERTS
  # ==============================================================================
  
  - name: 'adtlas-security'
    # Immediate notification to security team
    email_configs:
      - to: '${ALERT_EMAIL_SECURITY}'
        html: |
          <h2 style="color: orange;">🔒 SECURITY ALERT DETECTED 🔒</h2>
          
          {{ range .Alerts }}
          <div style="border: 2px solid orange; padding: 15px; margin: 10px 0; background-color: #fff8f0;">
            <h3 style="color: orange;">{{ .Annotations.summary }}</h3>
            <p><strong>Description:</strong> {{ .Annotations.description }}</p>
            <p><strong>Service:</strong> {{ .Labels.service }}</p>
            <p><strong>Instance:</strong> {{ .Labels.instance }}</p>
            <p><strong>Started:</strong> {{ .StartsAt.Format "2006-01-02 15:04:05" }}</p>
            {{ if .Annotations.runbook_url }}
            <p><strong>Runbook:</strong> <a href="{{ .Annotations.runbook_url }}">{{ .Annotations.runbook_url }}</a></p>
            {{ end }}
          </div>
          {{ end }}
          
          <p style="color: orange; font-weight: bold;">
            This is a security-related alert requiring immediate investigation.
          </p>
        headers:
          From: '${ALERT_EMAIL_DEFAULT}'
          subject: '🔒 [SECURITY] Adtlas Security Alert: {{ .GroupLabels.alertname }}'
          To: '${ALERT_EMAIL_SECURITY}'
          X-Adtlas-Alert: 'true'
          X-Security-Event: 'true'
          X-Priority: 'urgent'
    
  # ==============================================================================
  # BUSINESS IMPACT ALERTS
  # ==============================================================================
  
  - name: 'adtlas-business-critical'
    email_configs:
      - to: '${ALERT_EMAIL_BUSINESS}'
        html: |
          <h2 style="color: purple;">💼 BUSINESS CRITICAL ALERT</h2>
          
          {{ range .Alerts }}
          <div style="border: 2px solid purple; padding: 15px; margin: 10px 0; background-color: #faf5ff;">
            <h3 style="color: purple;">{{ .Annotations.summary }}</h3>
            <p><strong>Description:</strong> {{ .Annotations.description }}</p>
            <p><strong>Business Impact:</strong> <span style="color: purple; font-weight: bold;">{{ .Annotations.business_impact }}</span></p>
            <p><strong>Service:</strong> {{ .Labels.service }}</p>
            <p><strong>Started:</strong> {{ .StartsAt.Format "2006-01-02 15:04:05" }}</p>
          </div>
          {{ end }}
          <p style="color: purple; font-weight: bold;">
            This is a critical business impact alert requiring immediate attention.
          </p>
        headers:
          From: '${ALERT_EMAIL_DEFAULT}'
          subject: '💼 [BUSINESS CRITICAL] Adtlas: {{ .GroupLabels.alertname }}'
          To: '${ALERT_EMAIL_BUSINESS}'
          X-Adtlas-Alert: 'true'
          X-Business-Impact: 'true'
          X-Priority: 'urgent'
 
  - name: 'adtlas-business-high'
    email_configs:
      - to: '${ALERT_EMAIL_BUSINESS}'
        html: |
          <h2 style="color: blue;">📈 HIGH BUSINESS IMPACT ALERT</h2>
          
          {{ range .Alerts }}
          <div style="border: 2px solid blue; padding: 15px; margin: 10px 0; background-color: #f0f8ff;">
            <h3 style="color: blue;">{{ .Annotations.summary }}</h3>
            <p><strong>Description:</strong> {{ .Annotations.description }}</p>
            <p><strong>Business Impact:</strong> <span style="color: blue; font-weight: bold;">{{ .Annotations.business_impact }}</span></p>
            <p><strong>Service:</strong> {{ .Labels.service }}</p>
            <p><strong>Started:</strong> {{ .StartsAt.Format "2006-01-02 15:04:05" }}</p>
          </div>
          {{ end }}
          <p style="color: blue; font-weight: bold;">
            This is a high business impact alert requiring immediate attention.
          </p>
        headers:
          From: '${ALERT_EMAIL_DEFAULT}'
          subject: '📈 [HIGH IMPACT] Adtlas: {{ .GroupLabels.alertname }}'
          To: '${ALERT_EMAIL_BUSINESS}'
          X-Adtlas-Alert: 'true'
          X-Business-Impact: 'true'
          X-Priority: 'urgent'
  
  # ==============================================================================
  # TEAM-SPECIFIC RECEIVERS
  # ==============================================================================
  
  # Database team alerts
  - name: 'adtlas-database'
    email_configs:
      - to: '${ALERT_EMAIL_DATABASE}'
        html: |
          <h2>🗄️ Database Alert</h2>
          {{ range .Alerts }}
          <div style="border: 1px solid #4a90e2; padding: 10px; margin: 10px 0;">
            <h3>{{ .Annotations.summary }}</h3>
            <p><strong>Description:</strong> {{ .Annotations.description }}</p>
            <p><strong>Database:</strong> {{ .Labels.database }}</p>
            <p><strong>Instance:</strong> {{ .Labels.instance }}</p>
            <p><strong>Started:</strong> {{ .StartsAt.Format "2006-01-02 15:04:05" }}</p>
          </div>
          {{ end }}
          <p style="color: red; font-weight: bold;">
            This is a database alert requiring immediate attention.
          </p>
        headers:
          From: '${ALERT_EMAIL_DEFAULT}'
          subject: '🗄️ [DATABASE] Adtlas Database Alert: {{ .GroupLabels.alertname }}'
          To: '${ALERT_EMAIL_DATABASE}'
          X-Adtlas-Alert: 'true'
          X-Database-Event: 'true'
          X-Priority: 'urgent'
 
  # Infrastructure team alerts
  - name: 'adtlas-infrastructure'
    email_configs:
      - to: '${ALERT_EMAIL_INFRASTRUCTURE}' 
        html: |
          <h2>🏗️ Infrastructure Alert</h2>
          {{ range .Alerts }}
          <div style="border: 1px solid #f39c12; padding: 10px; margin: 10px 0;">
            <h3>{{ .Annotations.summary }}</h3>
            <p><strong>Description:</strong> {{ .Annotations.description }}</p>
            <p><strong>Component:</strong> {{ .Labels.component }}</p>
            <p><strong>Instance:</strong> {{ .Labels.instance }}</p>
            <p><strong>Started:</strong> {{ .StartsAt.Format "2006-01-02 15:04:05" }}</p>
          </div>
          {{ end }}
          <p style="color: red; font-weight: bold;">
            This is an infrastructure alert requiring immediate attention.
          </p>
        headers:
          From: '${ALERT_EMAIL_DEFAULT}'
          subject: '🏗️ [INFRASTRUCTURE] Adtlas Infrastructure Alert: {{ .GroupLabels.alertname }}'
          To: '${ALERT_EMAIL_INFRASTRUCTURE}'
          X-Adtlas-Alert: 'true'
          X-Infrastructure-Event: 'true'
          X-Priority: 'urgent'
  
  # Application team alerts
  - name: 'adtlas-application'
    email_configs:
      - to: '${ALERT_EMAIL_APPLICATION}' 
        html: |
          <h2>💻 Application Alert</h2>
          {{ range .Alerts }}
          <div style="border: 1px solid #27ae60; padding: 10px; margin: 10px 0;">
            <h3>{{ .Annotations.summary }}</h3>
            <p><strong>Description:</strong> {{ .Annotations.description }}</p>
            <p><strong>Service:</strong> {{ .Labels.service }}</p>
            <p><strong>Component:</strong> {{ .Labels.component }}</p>
            <p><strong>Instance:</strong> {{ .Labels.instance }}</p>
            <p><strong>Started:</strong> {{ .StartsAt.Format "2006-01-02 15:04:05" }}</p>
          </div>
          {{ end }}
          <p style="color: red; font-weight: bold;">
            This is an application alert requiring immediate attention.
          </p>
        headers:
          From: '${ALERT_EMAIL_DEFAULT}'
          subject: '💻 [APPLICATION] Adtlas Application Alert: {{ .GroupLabels.alertname }}'
          To: '${ALERT_EMAIL_APPLICATION}'
          X-Adtlas-Alert: 'true'
          X-Application-Event: 'true'
          X-Priority: 'urgent'
  
  # Monitoring team alerts
  - name: 'adtlas-monitoring'
    email_configs:
      - to: '${ALERT_EMAIL_MONITORING}' 
        html: |
          <h2>📊 Monitoring System Alert</h2>
          {{ range .Alerts }}
          <div style="border: 1px solid #9b59b6; padding: 10px; margin: 10px 0;">
            <h3>{{ .Annotations.summary }}</h3>
            <p><strong>Description:</strong> {{ .Annotations.description }}</p>
            <p><strong>Component:</strong> {{ .Labels.component }}</p>
            <p><strong>Started:</strong> {{ .StartsAt.Format "2006-01-02 15:04:05" }}</p>
          </div>
          {{ end }}
          <p style="color: red; font-weight: bold;">
            This is a monitoring alert requiring immediate attention.
          </p>
        headers:
          From: '${ALERT_EMAIL_DEFAULT}'
          subject: '📊 [MONITORING] Adtlas Monitoring Alert: {{ .GroupLabels.alertname }}'
          To: '${ALERT_EMAIL_MONITORING}'
          X-Adtlas-Alert: 'true'
          X-Monitoring-Event: 'true'
          X-Priority: 'urgent'
  
  # ==============================================================================
  # SPECIAL RECEIVERS
  # ==============================================================================
  
  # Maintenance mode receiver - minimal notifications
  - name: 'adtlas-maintenance'
    email_configs:
      - to: '${ALERT_EMAIL_MAINTENANCE}' 
        html: |
          <h2>🔧 Maintenance Window Alert</h2>
          <p>Alert during maintenance window:</p>
          {{ range .Alerts }}
          <div style="border: 1px solid #95a5a6; padding: 10px; margin: 10px 0; background-color: #f8f9fa;">
            <p>{{ .Annotations.summary }}</p>
          </div>
          {{ end }}
          <p style="color: red; font-weight: bold;">
            This is a maintenance alert requiring immediate attention.
          </p>
        headers:
          From: '${ALERT_EMAIL_DEFAULT}'
          subject: '🔧 [MAINTENANCE] Adtlas Maintenance Alert: {{ .GroupLabels.alertname }}'
          To: '${ALERT_EMAIL_MAINTENANCE}'
          X-Adtlas-Alert: 'true'
          X-Maintenance-Event: 'true'
          X-Priority: 'urgent'
  
  # Test environment receiver
  - name: 'adtlas-test'
    email_configs:
      - to: '${ALERT_EMAIL_TEST}' 
        html: |
          <h2>🧪 Test Environment Alert</h2>
          {{ range .Alerts }}
          <div style="border: 1px solid #17a2b8; padding: 10px; margin: 10px 0;">
            <h3>{{ .Annotations.summary }}</h3>
            <p><strong>Description:</strong> {{ .Annotations.description }}</p>
            <p><strong>Service:</strong> {{ .Labels.service }}</p>
            <p><strong>Started:</strong> {{ .StartsAt.Format "2006-01-02 15:04:05" }}</p>
          </div>
          {{ end }}
          <p style="color: red; font-weight: bold;">
            This is a test environment alert requiring immediate attention.
          </p>
        headers:
          From: '${ALERT_EMAIL_DEFAULT}'
          subject: '🧪 [TEST] Adtlas Test Alert: {{ .GroupLabels.alertname }}'
          To: '${ALERT_EMAIL_TEST}'
          X-Adtlas-Alert: 'true'
          X-Test-Event: 'true'
          X-Priority: 'urgent'

# ==============================================================================
# ALERTMANAGER CONFIGURATION NOTES
# ==============================================================================
#
# This configuration provides:
# 1. Multi-tier alert routing based on severity and business impact
# 2. Team-specific notification channels
# 3. Escalation policies for critical alerts
# 4. Security event special handling
# 5. Business hours vs after-hours routing
# 6. Maintenance mode support
# 7. Alert grouping and deduplication
# 8. Inhibition rules to reduce noise
#
# Environment Variables Required:
# - SMTP_HOST, SMTP_PORT, SMTP_USERNAME, SMTP_PASSWORD
# - ALERT_EMAIL_* (various email addresses)  
#
# Notification Channels:
# 1. Email - for all alert types with detailed information 
#
# Customization:
# 1. Adjust routing rules based on team structure
# 2. Configure business hours based on timezone
# 3. Add additional receivers for specific services
# 4. Customize templates for better formatting
# 5. Add webhook integrations for other tools
# 6. Configure silence patterns for known issues
# ==============================================================================