clawchain/monitoring/alertmanager.yml
2026-05-15 19:18:10 +03:00

114 lines
3.1 KiB
YAML

# ClawChain Alertmanager Configuration
# Routes alerts to Slack and PagerDuty based on severity.
#
# This is the canonical config referenced by deploy/k8s and docker-compose.
# The full config with templates lives in monitoring/alertmanager/alertmanager.yml.
#
# Required environment variables:
# SLACK_WEBHOOK_URL - Slack incoming webhook URL
# PAGERDUTY_SERVICE_KEY - PagerDuty Events API v2 integration key
global:
resolve_timeout: 5m
slack_api_url: "${SLACK_WEBHOOK_URL}"
templates:
- "/etc/alertmanager/templates/*.tmpl"
route:
receiver: slack-warnings
group_by: ["alertname", "chain_id"]
group_wait: 30s
group_interval: 5m
repeat_interval: 4h
routes:
# Critical: PagerDuty + Slack
- match:
severity: critical
receiver: pagerduty-critical
group_wait: 10s
repeat_interval: 1h
continue: true
- match:
severity: critical
receiver: slack-critical
group_wait: 10s
repeat_interval: 1h
# Warning: Slack only
- match:
severity: warning
receiver: slack-warnings
group_wait: 30s
repeat_interval: 4h
# Info: Slack low-priority channel
- match:
severity: info
receiver: slack-info
group_wait: 1m
repeat_interval: 12h
inhibit_rules:
- source_match:
alertname: ChainHalted
target_match:
alertname: SlowBlockTime
equal: ["chain_id"]
- source_match:
severity: critical
target_match:
severity: warning
equal: ["chain_id", "instance"]
receivers:
- name: slack-critical
slack_configs:
- channel: "#clawchain-alerts-critical"
send_resolved: true
title: "[{{ .Status | toUpper }}] {{ .GroupLabels.alertname }}"
text: |
*Chain:* {{ .GroupLabels.chain_id }}
*Severity:* {{ .CommonLabels.severity }}
{{ range .Alerts }}
*Alert:* {{ .Labels.alertname }}
*Summary:* {{ .Annotations.summary }}
*Description:* {{ .Annotations.description }}
*Runbook:* {{ .Annotations.runbook }}
{{ end }}
color: '{{ if eq .Status "firing" }}danger{{ else }}good{{ end }}'
- name: slack-warnings
slack_configs:
- channel: "#clawchain-alerts"
send_resolved: true
title: "[{{ .Status | toUpper }}] {{ .GroupLabels.alertname }}"
text: |
*Chain:* {{ .GroupLabels.chain_id }}
{{ range .Alerts }}
*Summary:* {{ .Annotations.summary }}
{{ end }}
color: '{{ if eq .Status "firing" }}warning{{ else }}good{{ end }}'
- name: slack-info
slack_configs:
- channel: "#clawchain-ops"
send_resolved: false
title: "[INFO] {{ .GroupLabels.alertname }}"
text: |
{{ range .Alerts }}{{ .Annotations.summary }}{{ end }}
- name: pagerduty-critical
pagerduty_configs:
- service_key: "${PAGERDUTY_SERVICE_KEY}"
severity: critical
description: |
{{ .GroupLabels.alertname }}: {{ .CommonAnnotations.summary }}
details:
chain_id: "{{ .GroupLabels.chain_id }}"
firing: "{{ .Alerts.Firing | len }}"
resolved: "{{ .Alerts.Resolved | len }}"