跳至主要內容
在 HTTP API 中使用 PromQL

Prometheus 当前稳定的 HTTP API 可以通过 /api/v1 访问。

Prometheus 提供了一套 HTTP API,其中包括查询(Query)和查询范围(Query Range)API,它们允许你使用 PromQL(Prometheus Query Language)从 Prometheus Server 中检索指标数据。这些 API 为外部系统、监控仪表板(如 Grafana)和脚本提供了一种标准化的方式来访问 Prometheus 存储的时间序列数据。

查询(Query)API

查询 API (/api/v1/query) 用于获取 Prometheus Server 当前的即时快照数据。这意味着它返回的是最近接收到的数据点。这个 API 接受一个 PromQL 表达式作为查询参数,并返回与该表达式匹配的最新数据点。


鸟书大约 2 分钟monitorprometheuspromqlhttpapi