0- Introduction
When we released a micro-services, we hope that the various operating conditions of each application will be a monitoring; this time of spring boot admin, you played;
spring boot admin: open source monitoring component is a spring boot monitor and manage applications, it enables the interface of the display of information in the Actuator can also monitor the health of all Spring Boot applications, provides real-time alarm function.
First, the integrated spring boot admin
1, create a server-side:
1.1, create a monitor module, add dependencies:
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server</artifactId>
<version>2.0.5</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>2.0.5</version>
</dependency>
1.2, annotation startup class increase @EnableAdminServer
@SpringBootApplication @EnableEurekaClient @EnableAdminServer public class application { public static void main(String[] args) { SpringApplication.run(application.class); } }
Complete server
2, the client (need to monitor the application side):
2.1, adding a dependency:
<! - Integrated Admimn monitoring -> <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-client</artifactId> <version>2.0.5</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency>
2.2, the configuration file to increase the allocation:
spring: application: name: user boot: admin: client: url: http://localhost:8771 management: endpoints: web: exposure: include: "*"
carry out
3, run the test
Start followed by the relevant project, open the monitor address, you can see, the monitoring project has added a variety of monitoring, it is convenient that we view health status, including:
Monitor status display applications, offline monitoring on the application, see the JVM, thread information, visualization view the log files and download log, log dynamic switching level, Http request information tracking; can go in-depth understanding of each monitoring item;
GITdemo Address: https://github.com/anson-yang/springclouddemo