考察点:告警规则落地——能写出合法的 YAML 规则,并讲清四个字段的语义(尤其 for 防抖、labels 做路由、annotations 给上下文)。要求阈值贴合 SLO。
要点:
groups:
- name: instance-health
rules:
- alert: HighCpuUsage
expr: 100 * (1 - avg by(instance)(rate(node_cpu_seconds_total{mode="idle"}[5m]))) > 80
for: 5m
labels:
severity: warning
annotations:
summary: "实例 {{ $labels.instance }} CPU 使用率过高"
description: "CPU 使用率已持续 5 分钟超过 80%(当前 {{ $value | printf \"%.1f\" }}%)"
{{ $labels.xxx }} 与 {{ $value }}(命中时表达式的值),便于运维一眼定位。expr: sum(rate(http_requests_total{code=~"5.."}[5m])) by(service) / sum(rate(http_requests_total[5m])) by(service) > 0.05。核心:一条规则 = 正确的 expr + 合理的 for 防抖 + labels 做路由 + annotations 给上下文;阈值要贴合 SLO,而非拍脑袋。
题目与答案就在本页;收藏、批注和错题重练在应用内