Provide Best Programming Tutorials

Use spring-boot-admin to monitor springboot application

In the previous article: SpringBoot Actuator we introducing the use of the Spring Boot Actuator, the Spring Boot Actuator provides monitoring of a single Spring Boot, including: application state, memory, threads, stacks, etc., to comprehensively monitor the entire lifecycle of the Spring Boot application.

However, there are some problems with this monitoring.

  • First, all monitoring needs to call a fixed interface to view. If you view the application status comprehensively, you need to call many interfaces, and the Json information returned by the interface is not convenient for the operator to understand.
  • Second, if Spring Boot The application cluster is very large, and each application needs to call different interfaces to view the monitoring information, which is very cumbersome and inefficient.

In this context, another open source software was born: Spring Boot Admin.

What is Spring Boot Admin?

Spring Boot Admin is an open source software for managing and monitoring Spring Boot applications. Each application is considered a client and is registered to the admin server via HTTP or Eureka for display. The Spring Boot Admin UI section uses VueJs to present the data to the front end.

This article shows you how to use Spring Boot Admin to monitor Spring Boot applications.

Monitor single application

This section shows you how to monitor a single Spring Boot application using Spring Boot Admin.

Admin Server

Project dependency

<dependencies>
  <dependency>
    <groupId>de.codecentric</groupId>
    <artifactId>spring-boot-admin-starter-server</artifactId>
    <version>2.1.0</version>
  </dependency>
  <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
  </dependency>
</dependencies>

application.properties

server.port=8000

starter class

@Configuration
@EnableAutoConfiguration
@EnableAdminServer
public class AdminServerApplication {

  public static void main(String[] args) {
    SpringApplication.run(AdminServerApplication.class, args);
  }
}

After completing the above three steps, start the server, in the browser visit http://localhost:8000 

 

Admin Client

project dependency

<dependencies>
    <dependency>
      <groupId>de.codecentric</groupId>
      <artifactId>spring-boot-admin-starter-client</artifactId>
      <version>2.1.0</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

application.properties

server.port=8001
spring.application.name=Admin Client
spring.boot.admin.client.url=http://localhost:8000  
management.endpoints.web.exposure.include=*
  • spring.boot.admin.client.url  Admin Server address
  • management.endpoints.web.exposure.include=* open Actuator monitorning

starter class

@SpringBootApplication
public class AdminClientApplication {
  public static void main(String[] args) {
    SpringApplication.run(AdminClientApplication.class, args);
  }
}

After the configuration is complete, start the client, and the Admin server will automatically check the client changes and display its application.

The page will display a list of monitored services. Clicking on the project name will take you to the detailed monitoring information for this application.

As you can see from the above figure, Spring Boot Admin graphically presents the application’s information, mostly from the interface provided by the Spring Boot Actuator.

SpringBoot Admin Mannual

http://codecentric.github.io/spring-boot-admin/1.5.6/#getting-started

Source Code

Download Address: https://github.com/AndrewProgramming/springbootTutorialCode/tree/master/spring-boot-admin-simple

Leave a Reply

Close Menu