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
<