I. Overview
Before you begin reading this article, it is recommended at first reading "SpringBoot the Actuator" , the article mentioned Spring Boot Actuator provides monitoring of single Spring Boot, the information includes: application state, memory, threads, stacks and so on, more comprehensive monitoring the entire life cycle of Spring Boot application. But the fly in the ointment is:
- All monitors need to call a fixed interface to view, if a comprehensive view of application state need to call a lot of interfaces, and the interface is not convenient to return Json information operations staff understand;
- If Spring Boot Application Clusters is very large, each application will need to call a different interface to view monitoring information, the operation is very cumbersome inefficient.
In this context, it is the birth of another open-source software: Spring Boot Admin. Spring Boot Admin So what is it? Spring Boot Admin is a tool to monitor UI landscaping package for Spring Boot Actuator. Each Application Clusters are considered to be a client (or instance), by using HTTP or register to Eureka Spring Boot Admin Server in on display, Spring Boot Admin UI AngularJs use the data displayed in the front.
The following will tell you how to use the Spring Boot Admin for Spring Boot application monitoring.
二、spring-boot-admin-starter-server
The following describes the construction of spring-boot-admin-server, to monitor each client (or instance), you can register Actuator data to the server in a UI rendering show.
1. pom.xml
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>2.1.5</version>
</dependency>
2. application.yml
server:
port: 3333
spring:
application:
name: monitor
3. Application.java
@SpringBootApplication
@EnableAdminServer
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class);
}
}
Finished above action, we a spring-boot-admin-server project build better.
三、spring-boot-admin-starter-client
We've got a spring-boot-admin-server, how to do now is put the client registration (or instances) of Actuator data to Server.
1. pom.xml
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.1.5</version>
</dependency>
2. application.yml
spring:
application:
name: dubbo-provider
boot:
admin:
enabled: true
client:
instance:
name: ${spring.application.name}
prefer-ip: true
url: http://127.0.0.1:3333
management:
endpoints:
web:
exposure:
include: '*'
So, we put the client (or instances) of Actuator in the data registered in the Server.
Epilogue
FIG. 1. Effect
2. Source address
Github demo code address: https: //github.com/JMCuixy/dubbo-demo