用途:该技能用于配置 Prometheus,实现对基础设施与应用的综合指标采集、告警与监控,适用场景包括搭建 Prometheus 监控、配置指标抓取、编写记录规则与告警规则、实现服务发现。
主要能力:提供 Prometheus 架构说明(应用通过 /metrics 暴露指标,Prometheus 定期抓取,并连接 AlertManager、Grafana 与长期存储 Thanos/Cortex);涵盖安装方式,如 Kubernetes 的 Helm 命令 helm repo add prometheus-community https://prometheus-community.github.io/helm-charts、helm repo update 及 helm install prometheus prometheus-community/kube-prometheus-stack;也提供 Docker Compose 部署示例。
使用方式:配置文件 prometheus.yml 包含 global、alerting、rule_files、scrape_configs 等段落;支持静态目标、基于文件的服务发现(file_sd_configs)与 Kubernetes 服务发现(kubernetes_sd_configs)加 relabel 配置。记录规则与告警规则以 YAML 分组编写,例如 ServiceDown、HighErrorRate、HighCPUUsage 等。可用 promtool check config prometheus.yml、promtool check rules 校验配置与规则,并可通过 http://localhost:9090/api/v1/targets 等接口排查。
限制:资料未提供具体收费、价格信息;未说明实际监控效果或性能数据;部分参考文件(如 assets/prometheus.yml.template、references/scrape-configs.md、scripts/validate-prometheus.sh)仅被提及,未给出完整内容。