先简单的暴露springboot的prometheus端口暴露给prometheus,让它采集jvm的信息。
maven依赖:
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
配置application.yml,暴露所有端口:
management:
endpoints:
web:
exposure:
include: '*'
访问端口数据:
先查看暴露出来的所有端口: