Skip to content

Alerting

一句话解释

Alerting 是练习的 automatically notifying team 当 metrics cross thresholds or 错误 occur.

用大白话说

Alerting is how you find out about problems before your users do. You define rules — e.g., "如果错误速率 > 5% for 5 minutes, alert team" — and when the condition is met, the system sends a notification.

Good alerting is a balance. Too few alerts and you miss critical issues. Too many alerts and you get alert fatigue — the team ignores them all. The best alerts are actionable: when an alert fires, there is a clear action to take.

Alerts are routed through an Alertmanager (like Prometheus Alertmanager) to the right destination — Slack for warnings, PagerDuty for critical issues at 3 AM, email for informational alerts. Alerts should include enough context (links to dashboards, logs) to help diagnose the problem.

示例

yaml
# Alertmanager routing
route:
  receiver: 'slack'
  routes:
    - match:
        severity: critical
      receiver: 'pagerduty'
receivers:
  - name: 'slack'
    slack_configs:
      - api_url: 'https://hooks.slack.com/...'
  - name: 'pagerduty'
    pagerduty_configs:
      - service_key: 'your-key'

这个 routes 关键 alerts 到 PagerDuty and 所有 others 到 Slack.

工作原理

  1. You define alert rules (e.g., error rate > 5% for 5 min).
  2. The monitoring system evaluates rules continuously.
  3. When a rule fires, it sends an alert to the Alertmanager.
  4. The Alertmanager routes the alert to the right channel (Slack, PagerDuty, email).

常见混淆

  • 容易混淆的对象: Monitoring

    关键区别: Monitoring collects and displays metrics; alerting 是操作 taken 当 metrics indicate problem. Alerting 是部分的 monitoring.

相关术语

解读错误信息

用大白话解释常见错误——什么意思、为什么发生、如何修复。

查看错误

← 返回术语表