用途
该技能用于实现全面的基础设施监控,跟踪整个技术栈的系统健康、性能指标与资源利用率,并提供告警与可视化能力。
主要能力
- 指标采集与监控:通过 Prometheus 采集指标,示例配置中设置了全局抓取间隔与评估间隔(均为 15s),并带有外部标签(monitor、environment)。
- 告警能力:配置 Alertmanager 作为告警接收端,并通过 rule_files 加载告警规则文件(alerts.yml、rules.yml)。
- 可视化:提供 Grafana 仪表盘参考指南。
- 参考指南:references/ 目录下包含 Prometheus 配置、告警规则、Alertmanager 配置、Grafana 仪表盘、监控部署等详细实现说明。
使用方式
资料给出的最小可用示例为一份 prometheus.yml 配置,内容包括:
# prometheus.yml
global:
scrape_interval: 15s
evaluation_interval: 15s
external_labels:
monitor: "infrastructure-monitor"
environment: "production"
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
- localhost:9093
# Rule files
rule_files:
- "alerts.yml"
- "rules.yml"
scrape_configs:
# Prometheus itself
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
完整实现需参考 references/ 目录下的各份指南。
适用场景
- 实时性能监控
- 容量规划与趋势分析
- 事件检测与告警
- 服务健康追踪
- 资源利用率分析
- 性能排障
- 合规与审计记录
- 历史数据分析
最佳实践
建议:遵循既有模式与约定;编写整洁、可维护的代码;补充适当文档;部署前充分测试。 不建议:跳过测试或验证;忽略错误处理;硬编码配置值。
限制
资料未提供具体的安装命令、依赖版本、支持的平台范围、收费方式或实际运行效果等信息,暂未提供。