带有Prometheus的弹簧靴和Micrometer第5部分:旋转Prometheus

以前,我们获得了Spring Boot Application适配器,以便为Prometheus公开端点。
该博客将重点介绍如何设置和配置Prometheus,以便为Spring Boot端点提供服务器。
因此,让我们开始使用docker来启动Prometheus服务器。

在继续进行Prometheus升级之前,我们需要提供一个配置文件以从应用程序中提取数据。
因此,我们应该提供包含以下内容的prometheus.yaml文件。

 scrape_configs: 
   - job_name: 'prometheus-spring' 
     scrape_interval: 1m 
     metrics_path: '/actuator/prometheus' 
     static_configs: 
       - targets: [ 'my.local.machine:8080' ] 

让我们使用从此处获取的命令。

由于通过docker在osx上使用了prometheus,因此我们需要一些解决方法来通过应用进行连接

 sudo ifconfig lo0 alias 172.16.222.111 

我们可以直接使用docker

 docker run - v /path/to/prometheus .yaml: /etc/prometheus/prometheus .yml -p 9090:9090 --add-host= "my.local.machine:172.16.222.111" prom /prometheus 

通过执行上述操作,我们将能够从docker映像内部与本地应用程序进行交互。

因此,如果我们导航到http:// localhost:9090 / graph,我们将被Prometheus屏幕所欢迎。
同样,在我们的prometheus容器内,我们还能够与应在本地运行的应用程序进行通信。

因此,让我们花一些时间看看是否已收集数据。 然后,我们转到Prometheus状态页面http:// localhost:9090 / status

我们将被我们的应用程序的JVM信息所吸引。

在下一个博客中,我们将重点介绍保护Prometheus 端点的方法

翻译自: https://www.javacodegeeks.com/2020/05/spring-boot-and-micrometer-with-prometheus-part-5-spinning-up-prometheus.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值