简介
codecentric’s Spring Boot Admin is a community project to manage and monitor your Spring Boot ® applications. The applications register with our Spring Boot Admin Client (via HTTP) or are discovered using Spring Cloud ® (e.g. Eureka, Consul). The UI is just a Vue.js application on top of the Spring Boot Actuator endpoints.
Support for Python applications is available using Pyctuator.
1.服务端
1.1 pom.xml配置
<properties>
<java.version>11</java.version>
<spring-boot-admin.version>2.3.1</spring-boot-admin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
...
...
...
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>${spring-boot-admin.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
1.2 修改启动类
//添加这个注解即可
@EnableAdminServer
@SpringBootApplication
public class MangoMonitorApplication {
public static void main(String[] args) {
SpringApplication.run(MangoMonitorApplication.class, args);
}
}
1.3直接启动服务端,访问http://ip:port即可
2. 客户端配置
2.1 pom.xml配置
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.6.2</version>
</dependency>
2.2 yml文件配置
server:
port: 8081
spring:
application:
name: demo
#以下是spring-boot-admin的配置
boot:
admin:
client:
url: http://localhost:8000
#以下是spring-boot-admin中嵌套的actuator的配置
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: always
2.3 直接启动客户端即可,启动成功后,admin管理界面会发生变化,如下:
点击在线应用的某一个实例,即可进入详细的客户端监控页面,如下: