Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

prometheus-alertmanager

БесплатноБез исполняемых скриптовНе проверен

Configure Prometheus Alertmanager for alert routing, grouping, silencing, and notification delivery. Use when a user needs to set up alert receivers (Slack…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

Prometheus Alertmanager

Overview

Configure Alertmanager to handle alerts from Prometheus, route them to the correct receivers, group related alerts, suppress duplicates, and manage silences. Covers routing trees, receiver configuration, inhibition rules, and high-availability setup.

Instructions

Task A: Basic Alertmanager Configuration

Secrets stay in files that Alertmanager reads at start and reload (*_file options), not inside the YAML. Use matchers (label-matcher strings) in routes and inhibit rules: match, match_re, source_match and target_match are deprecated and only kept for compatibility. The first matching child route wins unless it sets continue: true, so list specific routes (payments) first.

# alertmanager.yml — Main Alertmanager configuration
global:
  resolve_timeout: 5m
  smtp_smarthost: 'smtp.mailgun.org:587'
  smtp_from: '[email protected]'
  smtp_auth_username: '[email protected]'
  smtp_auth_password_file: /etc/alertmanager/secrets/smtp-password
  slack_api_url_file: /etc/alertmanager/secrets/slack-webhook-url

route:
  receiver: default-slack
  group_by: ['alertname', 'cluster', 'service']
  group_wait: 30s
  group_interval: 5m
  repeat_interval: 4h
  routes:
    - matchers:
        - service=~"payment|billing"
      receiver: payments-team
      routes:
        - matchers:
            - severity="critical"
          receiver: pagerduty-payments
    - matchers:
        - severity="critical"
      receiver: pagerduty-critical
      group_wait: 10s
      repeat_interval: 1h
    - matchers:
        - severity="warning"
      receiver: slack-warnings

receivers:
  - name: 'default-slack'
    slack_configs:
      - channel: '#ops-alerts'
        send_resolved: true
        title: '{{ .Status | toUpper }}: {{ .CommonLabels.alertname }}'
        text: >-
          {{ range .Alerts }}
          *{{ .Labels.alertname }}* on {{ .Labels.instance }}
          {{ .Annotations.description }}
          {{ end }}

  - name: 'pagerduty-critical'
    pagerduty_configs:
      # Events API v2 integration key (the "Integration Key" of a PagerDuty service)
      - routing_key_file: /etc/alertmanager/secrets/pagerduty-ops-key
        description: '{{ .CommonLabels.alertname }}: {{ .CommonAnnotations.summary }}'

  - name: 'slack-warnings'
    slack_configs:
      - channel: '#ops-warnings'
        send_resolved: true

  - name: 'payments-team'
    slack_configs:
      - channel: '#payments-alerts'
        send_resolved: true

  - name: 'pagerduty-payments'
    pagerduty_configs:
      - routing_key_file: /etc/alertmanager/secrets/pagerduty-payments-key

  - name: 'ops-email'
    email_configs:
      - to: '[email protected]'

inhibit_rules:
  - source_matchers:
      - severity="critical"
    target_matchers:
      - severity="warning"
    equal: ['alertname', 'cluster', 'service']
  - source_matchers:
      - alertname="ClusterDown"
    target_matchers:
      - alertname=~".+"
    equal: ['cluster']

Validate before every deploy: amtool check-config alertmanager.yml. Reload with curl -X POST http://localhost:9093/-/reload or by sending SIGHUP. pagerduty_configs with service_key is the older Prometheus-integration (Events v1) key; new setups use routing_key.

To limit a route to a schedule, define time_intervals and reference them with active_time_intervals (or silence a window with mute_time_intervals):

route:
  routes:
    - matchers: [ 'service=~"payment|billing"' ]
      receiver: payments-team
      active_time_intervals: [business-hours]

time_intervals:
  - name: business-hours
    time_intervals:
      - weekdays: ['monday:friday']
        times: [{ start_time: '08:00', end_time: '18:00' }]
        location: Europe/Berlin

Task B: Define Prometheus Alert Rules

# prometheus/rules/alerts.yml — Alert rules for Prometheus
groups:
  - name: service-alerts
    rules:
      - alert: HighErrorRate
        expr: |
          sum(rate(http_requests_total{status=~"5.."}[5m])) by (service)
          / sum(rate(http_requests_total[5m])) by (service) > 0.05
        for: 5m
        labels:
          severity: critical
        annotations:
          summary: "High error rate on {{ $labels.service }}"
          description: "Error rate is {{ $value | humanizePercentage }} for {{ $labels.service }}."

      - alert: HighLatency
        expr: |
          histogram_quantile(0.99, sum(rate(http_request_duration_seconds_bucket[5m])) by (le, service)) > 2
        for: 10m
        labels:
          severity: warning
        annotations:
          summary: "P99 latency above 2s on {{ $labels.service }}"
          description: "P99 latency is {{ $value }}s for {{ $labels.service }}."

      - alert: PodCrashLooping
        expr: increase(kube_pod_container_status_restarts_total[15m]) > 3
        for: 5m
        labels:
          severity: critical
        annotations:
          summary: "Pod {{ $labels.pod }} is crash loo
Полный SKILL.md на GitHub

Установить prometheus-alertmanager в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл prometheus-alertmanager?

Configure Prometheus Alertmanager for alert routing, grouping, silencing, and notification delivery. Use when a user needs to set up alert receivers (Slack, PagerDuty, email), define routing trees, manage silences and inhibition rules, or troubleshoot alert delivery pipelines.

Как установить скилл prometheus-alertmanager?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл prometheus-alertmanager запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить prometheus-alertmanager с