目录
article
Spring Boot Admin 添加自己本身到监控列表
Spring Boot Admin 添加自己本身到监控列表
添加 spring-boot-admin-server 及 spring-boot-admin-server-ui 依赖可以启用 Spring Boot Admin 监控服务。
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>2.2.1</version>
</dependency>
如果想将监控服务本身也添加到监控列表时,则仍需添加 spring-boot-admin-starter-client 依赖。
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.2.1</version>
</dependency>
同时也需要添加 spring.boot.admin.client 配置。配置文件示例如下:
server:
port: 8001
spring:
security:
user:
name: admin
password: password
boot:
admin:
client:
url: http://${spring-admin-ip}:8001
username: admin
password: password
instance:
prefer-ip: true
ui:
title: ${spring.application.name}
# 自定义 actuator 的端口及路径等
management:
server:
port: 7788
context-path: /cuzact
endpoints:
web:
base-path: /cuzact
exposure:
include: '*'
endpoint:
health:
show-details: ALWAYS