springboot集成prometheus和grafana

本文档详细介绍了如何在Ubuntu20.04系统下,将SpringBoot应用与Prometheus和Grafana进行集成。首先,通过更新pom.xml和application-dev.yml文件配置集成,接着下载并安装Prometheus,配置并启动服务。然后,通过Prometheus监控SpringBoot应用的http_server_requests_seconds_count指标。最后,安装并配置Grafana,导入模板,完成监控可视化展示。
摘要由CSDN通过智能技术生成

ubuntu20.04系统中springboot集成prometheus和grafana

pom.xml 注意依赖引入版本,避免冲突

<dependency>
	 <groupId>org.springframework.boot</groupId>
	 <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
		<groupId>io.micrometer</groupId>
		<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>

application-dev.yml

spring:
  application:
    name: springboot  #项目名
management:
  endpoints:
    web:
      exposure:
        include: 'prometheus'
  metrics:
    tags:
      application: ${spring.application.name}

启动项目 , 访问 http://localhost:8080/actuator/prometheus
如果下载这样的文件,那就没问题了:
在这里插入图片描述

开始下载安装 prometheus
下载地址:https://prometheus.io/download/
sudo tar zxvf prometheus-2.31.1.linux-amd64.tar.gz
修改配置文件:sudo vim prometheus.yml

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值