Categories
Uncategorized

SpringBoot Twenty-four: Application Monitoring of Admin

Author: Dream 1819
    Original: https: //www.cnblogs.com/yanfei1819/p/11457867.html
    Disclaimer: This article is a blogger original article, reproduced, please attach Bowen link!

introduction

Previous chapter (Chapter 22. SpringBoot: Application Monitoring of Actuator) describes the use of Actuctor SpringBoot application monitoring. Finally, the article also raises the question, Is it possible to monitor the results show a better operation and maintenance of the students?

This chapter answers this question.

Spring Boot Admin is a management and monitoring of Spring Boot application of open source projects. Into the admin-server admin-client two components, collected actuator by admin-server endpoint data, displayed on the spring-boot-admin-ui, almost all known endpoints acquisition, by spring-boot-admin dynamic switching log level, the log export, export heapdump, monitoring indicators and so on.

Spring Boot Admin also provides a cluster monitoring solution for single application services, supporting multiple service monitoring and management through eureka, consul, zookeeper and other registration centers.

Use of SpringBoot Admin

Create admin-server

First, the introduction of maven dependent on:


    org.springframework.boot
    spring-boot-starter-web


    de.codecentric
    spring-boot-admin-starter-server


    de.codecentric
    spring-boot-admin-server-ui

For convenience of distinction, the port number is defined as 8081:

server.port=8081

Annotation on the startup class @EnableAdminServer.

which is:

package com.yanfei1819.adminserver;

import de.codecentric.boot.admin.server.config.EnableAdminServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

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

Let’s take a look at the SpringBoot Admin interface:

page, create a client to monitor below.

Create admin-client

Introducing maven dependence:


    org.springframework.boot
    spring-boot-starter-web


    de.codecentric
    spring-boot-admin-starter-client

Set its port number is 8082:

server.port=8082
spring.boot.admin.client.url=http://localhost:8081
# 激活所有的端点的web方式请求。如果不激活,将看不到详细的监控信息。
management.endpoints.web.exposure.include=*

First start the admin-server, and then start the admin-client.

Here are the some of the interface:

Home monitoring:

Applications:

Execution log:

details:

In the above interface, including almost all of the monitoring information. Interested readers can learn more individually. Due to limited space here, not as a developing process.

If you need to monitor multiple client-side information, just in the client configuration file application.properties configure:

spring.boot.admin.client.url=http://localhost:8081
# 激活所有的端点的web方式请求。如果不激活,将看不到详细的监控信息。
management.endpoints.web.exposure.include=*

Source chapter wrote two clients, in order to simplify the text only demonstrates a.

to sum up

The above article only introduces the application of SpringBoot Admin. In real projects, you can do security authentication, permission setting, and even message notification.

So far, 24 articles have been written in this series. The feeling of using all the way down is simpler than understanding. The most important thing is to understand, understand the idea, the principle (of course, this series is not in depth due to the learners who are getting started with SpringBoot. Next will open another series, specialized in the principle of analysis), can be used handy, encountered problems and not only copy, paste, ask the bride.

Say an off-topic. This is a long time away from the previous one. The main thing is that the author has learned about distributed, high concurrency and MySQL in this period of time. I would like to share these with you later.

Finally, welcome Gangster Paizhuan.

ps: This series of source address.

Leave a Reply