用途:面向 Prometheus 监控系统的日常运维与排障,覆盖抓取配置、PromQL 查询、告警规则、记录规则、Alertmanager 路由、目标健康与 TSDB 管理。
主要能力:提供身份与路径信息(二进制 prometheus、服务 prometheus.service、配置 /etc/prometheus/prometheus.yml、规则目录 /etc/prometheus/rules/、数据目录 /var/lib/prometheus/、日志 journalctl -u prometheus、Web UI 与 API 端口 9090、Alertmanager 端口 9093)。给出常用操作命令,如 systemctl status prometheus、promtool check config /etc/prometheus/prometheus.yml、promtool check rules /etc/prometheus/rules/*.yml、curl -X POST http://localhost:9090/-/reload、curl 'http://localhost:9090/api/v1/query?query=up'、curl -s http://localhost:9090/api/v1/targets、curl -s http://localhost:9090/api/v1/status/tsdb 等,并说明 TSDB 快照与按标签删除序列需启用 --web.enable-admin-api。
使用方式:按资料中的命令检查配置、重载、查询 API、查看目标与告警、统计序列与基数;健康检查包括 systemctl is-active prometheus、curl -sf http://localhost:9090/-/healthy 等。
适用场景:目标 DOWN、抓取超时、配置重载失败、规则求值错误、样本过多、磁盘占满、Alertmanager 未收到或未路由告警、OOM 等故障排查。
限制:Prometheus 无内置认证,不应将 9090 直接暴露公网;默认保留 15 天,长期存储需 remote_write 到 Thanos、Mimir 或 VictoriaMetrics;高基数标签会显著影响性能,可用 metric_relabel_configs 的 labeldrop 处理;PromQL 中 range vector 与 instant vector 不可混用;Alertmanager 配置独立,需用 amtool config check 校验。其余细节暂未提供。