【发布时间】:2020-05-21 13:57:04
【问题描述】:
我们正在研究托管在物理服务器上的 Spring Boot 应用程序的监控和警报机制。经过一番研究,决定去
Actuators - 全方位监控应用程序
Prometheus - 度量存储
Grafana - 用于仪表板可视化和警报
在普罗米修斯出现之前一切顺利。在将指标提供给指标存储时遇到问题。
prometheus.yml
scrape_configs:
- job_name: 'spring-actuator'
metrics_path: '/actuator/prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:8080']
Prometheus 服务器日志
level=info ts=2020-02-05T15:05:20.873Z caller=main.go:762 msg="配置文件加载完成" filename=prometheus.yml level=info ts=2020-02-05T15:05:20.873Z caller=main.go:617 msg="服务器已准备好接收网络请求。"
Prometheus 仪表板显示没有要显示的数据。
旁注,Spring Boot 服务已启动,并在 localhost:8080/actuator/prometheus 被命中时返回数据。禁用了 Actuator 端点的敏感性。
actuator/prometheus 端点结果:
【问题讨论】:
-
grafana 是否真的在同一台主机上运行?在 docker 中运行不计入 docker 镜像中的 localhost 会将请求保留在实例中。
-
Spring boot 应用、Prometheus、Grafana 都在我的本地机器上运行。这里不涉及码头工人
-
您可以将整个输出添加到 txt 中吗?第二个问题 - 您实际上是否在仪表板中查询任何 Prometheus 指标?
标签: java spring-boot prometheus health-monitoring prometheus-alertmanager