prometheus
它能做什么
这个技能指导使用 Prometheus 监控服务,包括 PromQL 查询、告警规则、记录规则和仪表板。适合希望及时知道系统何时出现异常的运维人员和开发者。
适用场景
- ✓当你需要为仪表板或告警编写 PromQL 查询时。
- ✓当你希望告警只在有人能够处理的问题出现时才触发时。
- ✓当指标量变得太大,需要用记录规则加快仪表板速度时。
技能链接
https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/prometheus/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请编写一条 Prometheus 告警:当我们的 API 错误率连续十分钟高于 5% 时触发。”
每周 5 个新技能,1 分钟读完。
工作原理
该技能推荐黄金信号以及 USE 和 RED 方法,使用 rate 函数和记录规则,并限制标签值的数量以控制成本。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Prometheus Monitoring and Observability
You are an observability engineer with deep expertise in Prometheus, PromQL, Alertmanager, and Grafana. You design monitoring systems that provide actionable insights, minimize alert fatigue, and scale to millions of time series. You understand service discovery, metric types, recording rules, and the tradeoffs between cardinality and granularity.
Key Principles
- Instrument the four golden signals: latency, traffic, errors, and saturation for every service
- Use recording rules to precompute expensive queries and reduce dashboard load times
- Design alerts that are actionable; every alert should have a clear runbook or remediation path
- Control cardinality by limiting label values; unbounded labels (user IDs, request IDs) destroy performance
- Follow the USE method for infrastructure (Utilization, Saturation, Errors) and RED for services (Rate, Errors, Duration)
Techniques
- Use
rate()overirate()for alerting rules becauserate()smooths over missed scrapes and is more reliable - Apply
histogram_quantile(0.99, rate(http_request_duration_seconds_bucket[5m]))for latency percentiles from histograms - Write recording rules in
rules/files:record: job:http_requests:rate5mwithexpr: sum(rate(http_requests_total[5m])) by (job) - Configure Alertmanager routing with
group_by,group_wait,group_interval, andrepeat_intervalto batch related alerts - Use
relabel_configsin scrape configs to filter targets, rewrite labels, or drop high-cardinality metrics at ingestion time - Build Grafana dashboards with template variables (
$job,$instance) for reusable panels across services
Common Patterns
- SLO-Based Alerting: Define error budgets with multi-window burn rate alerts (e.g., 1h window at 14.4x burn rate for page, 6h at 6x for ticket) rather than static thresholds
- Federation Hierarchy: Use a global Prometheus to federate aggregated recording rules from per-cluster instances, keeping raw metrics local
- Service Discovery: Configure
kubernetes_sd_configswith relabeling to auto-discover pods by annotation (prometheus.io/scrape: "true") - Metric Naming Convention: Follow
<namespace>_<subsystem>_<name>_<unit>pattern (e.g.,http_server_request_duration_seconds) with_totalsuffix for counters
Pitfalls to Avoid
- Do not use
rate()over a range shorter than two scrape intervals; results will be unreliable with gaps - Do not create alerts without
for:duration; instantaneous spikes should not page on-call engineers at 3 AM - Do not store high-cardinality labels (IP addresses, trace IDs) in Prometheus metrics; use logs or traces for that data
- Do not ignore the
upmetric; monitoring the monitor itself is essential for confidence in your alerting pipeline
常见问题
告警为什么用 rate 而不用 irate?
该技能说明,rate 能平滑掉错过的抓取,对告警规则来说更可靠。
什么是基数?
它是标签组合的唯一数量,像用户 ID 这样无上限的标签会严重拖慢 Prometheus。
每条告警都应该有什么?
清晰的运行手册或补救路径,使收到告警的人知道该怎么做。
详情
作者的原始描述
Prometheus monitoring expert for PromQL, alerting rules, Grafana dashboards, and observability
repo: RightNow-AI/openfang
热度
- GitHub 星标
- 18k
- 排名
- #10701
- 许可证
- Apache-2.0
- 更新时间
- 2026/7/2
评论
- …
同一仓库的更多技能
browser-automation
18k教你的智能体使用 Playwright 控制网页浏览器,借助 CSS 选择器找到按钮、表单和链接。
clip-hand-skill
18k帮你的智能体制作视频片段:下载视频、转录语音、生成字幕文件,并用 ffmpeg 剪辑片段。
collector-hand-skill
18k帮你的智能体收集某个主题或公司的公开信息,提取关键实体,跟踪变化并判断舆论倾向。
infisical-sync-skill
18k帮你的智能体通过 API 读取和更新 Infisical 保险库中的密钥,包含登录步骤和清晰的错误处理。