关于 prometheus-monitoring
用于实施 Prometheus 监控的技能,面向应用和基础设施指标。内容涵盖配置、指标采集与查询、告警规则和运维实践,并提供 Node.js、Python 与 Docker Compose 参考指南。
主要功能
- 01配置 Prometheus 抓取
- 02采集应用和基础设施指标
- 03设置服务发现
- 04创建并测试告警规则
- 05制定指标命名与保留策略
适用场景
- 01为服务设置指标采集
- 02为 Node.js 或 Python 应用添加指标
- 03搭建监控基础设施
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ aj-geddes/ useful-ai-prompts --skill prometheus-monitoring安装后在 Claude Code 中输入/prometheus-monitoring确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
references/alert-rules.mddocker-compose-setup.mdnodejs-metrics-implementation.mdprometheus-configuration.mdpython-prometheus-integration.mdscripts/health-check.shtemplates/dashboard-config.yaml详细介绍
Prometheus 监控
目录
概述
构建全面的 Prometheus 监控基础设施,用于收集、存储和查询来自应用程序与基础设施的时间序列指标。
适用场景
- 设置指标收集
- 创建自定义应用程序指标
- 配置抓取目标
- 实现服务发现
- 构建监控基础设施
快速开始
最小可用示例:
# /etc/prometheus/prometheus.yml
global:
scrape_interval: 15s
evaluation_interval: 15s
external_labels:
cluster: production
alerting:
alertmanagers:
- static_configs:
- targets: ["localhost:9093"]
rule_files:
- "/etc/prometheus/alert_rules.yml"
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
- job_name: "node"
static_configs:
- targets: ["localhost:9100"]
- job_name: "api-service"
// ... (see reference guides for full implementation)
参考指南
references/ 目录中的详细实现:
| 指南 | 内容 |
|---|---|
| Prometheus 配置 | Prometheus 配置 |
| Node.js 指标实现 | Node.js 指标实现 |
| Python Prometheus 集成 | Python Prometheus 集成 |
| 告警规则 | 告警规则 |
| Docker Compose 设置 | Docker Compose 设置 |
最佳实践
✅ 应该做
- 使用一致的指标命名规范
- 添加全面的标签以便筛选
- 设置合适的抓取间隔(10-60 秒)
- 实施保留策略
- 监控 Prometheus 本身
- 在部署前测试告警规则
- 记录指标含义
❌ 不应该做
- 添加基数无界的标签
- 过于频繁地抓取(< 10 秒)
- 忽视指标命名规范
- 在没有运行手册的情况下创建告警
- 在 Prometheus 中存储原始事件数据
- 将计数器用于类似仪表盘的值
评论
支持 Markdown