Spring Boot Admin 监控不到网关解决方案
使用springbootadmin监控服务,需要注意2方面的问题
1、被监控服务接口提供问题
2、监控的地址是否正确(原则来说存在与Eureka注册中心中的服务都会自动被监控,默认地址改变例外)
被监控服务地址提供需要做以下事情:
1、坐标导入
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> </dependency>
2、开启接口
management: endpoint: shutdown: enabled: true #开启端点 health: show-details: always endpoints: web: exposure: include: "*" #开启所有接口
此时监控中心即可监控到服务了,但是注意:监控中心默认监控地址是:/actuator/**
也发现,在启动服务时候,默认映射路径也是/actuator/**,但是为什么就监控不到呢?
原因很简单,因为我们在根路径上追加了一个条路径:
这就是导致监控不到的原因所在,因此我们需要指定此时监控路径:
在eureka注册中心设置监控路径地址即可监控成功。