curl 命令 | 说明 |
curl localhost:8429/targets | 查询 target 抓取状态,会返回类似如下的打印信息。您可以通过 grep 的方式过滤具体的 job。对应 dashboard 的 target 列表。 在命令 curl -H 'accept:text/html' 'http://localhost:8429/targets' 中加上 accept header,可以返回 html 的格式。 |
curl localhost:8429/api/v1/targets | 查询较为详细的 JSON 形式的 target 信息,分为 activeTargets 和 droppedTargets,每个 targets 里包括 meta labels。 具体返回示例如下: |
curl localhost:8429/config | 查看 prometheus-agent 读取到的原始配置。一般用 servicemonitor 等 CR 配置采集,operator 会自动加上一些 relabel,可以通过这个命令查看到实际被 prometheus-agent 读取到的完整的 scrape 采集配置。 |
采集方式 | 对应格式 |
servicemonitor 采集 | serviceScrape/<namespace>/<servicemonitor-name>/n |
podmonitor 采集 | podScrape/<namespace>/<servicemonitor-name>/n |
vmnodescrape 采集 | nodeScrape/<namespace>/<servicemonitor-name>/n |
通过 pod 的 annotation 采集 | pod |