1、pom文件依赖
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.12.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-spring-legacy</artifactId>
<version>1.3.15</version>
</dependency>
</dependencies>
2、新增配置文件
server:
port: 8020
context-path: /${spring.application.name}
spring:
application:
name: prometheus-service
management:
port: ${SPRING_MANAGEMENT_PORT:10001}
context-path: /${spring.application.name}
security:
enabled: false
endpoints:
web:
exposure:
include:
- beans
- prometheus
- metrics
metrics:
tags:
application: ${spring.application.name}
3、启动spring boot ,网站查看信息;
prometheus信息
http://localhost:10001/prometheus-service/prometheus
bean信息
http://localhost:10001/prometheus-service/beans
metrics信息
http://localhost:10001/prometheus-service/metrics
4、prometheus 服务监控查看文章
https://blog.csdn.net/qq_32415063/article/details/105607008
https://blog.csdn.net/qq_32415063/article/details/105611704