验证 Prometheus 指标是否写入端点

虽然在本地环境中安装和配置 Prometheus 超出了本次学习旅程的范围,但一个好的第一步是验证您的系统正在将指标写入 Prometheus 端点。

验证 Prometheus 指标是否写入端点

  1. 登录安装了 Prometheus 的机器。

  2. 如果需要,切换到具有管理员权限的用户。

  3. 要检查 Prometheus 服务状态,运行以下任一命令:

    对于 Linux:systemctl status prometheus.service

    对于 Windows:sc query prometheus

    您应该看到类似以下内容:

    Picture that shows the Prometheus service up and running

  4. 为确保 Prometheus 正在捕获指标,打开浏览器标签页并导航至指标端点 URL。

    例如,导航至 https://:9090/metrics

    您应该看到类似以下内容:

    Picture that shows metrics in a browser tab

提示

如果您无法运行 Prometheus 服务或无法验证 Prometheus 是否正在捕获指标,请查阅 Prometheus 文档。