Home  >  Article  >  Java  >  What is the role and usage of springboot admin monitoring

What is the role and usage of springboot admin monitoring

WBOY
WBOYforward
2023-05-25 18:52:071829browse

Applicable scenarios:

1. The project scale is not large

2. The number of users is not large and the concurrency requirements are not strong

3. There is no dedicated operation and maintenance force

4. Exquisite team size

For some regular projects, or units where the division of corporate responsibilities is not very clear. Often a system goes from requirements to design, development, testing to final launch, operation and maintenance. Often 80% of the tasks are completed by the development team. Therefore, in addition to implementing the system's functions, developers must also provide customers with consultation and answer questions and solve production problems.

Just imagine, after an application is launched, there are no monitoring measures. Just like driving a car without any dashboard, no one feels safe on the road like this. How to balance simplicity and efficiency is something worth thinking about.

1. What is Springboot admin?

Spring Boot Admin is an open source community project for managing and monitoring SpringBoot applications. The application is registered with the Spring Boot Admin Server as a Spring Boot Admin Client (via HTTP) or discovered using a Spring Cloud registry (e.g. Eureka, Consul). Common functions or monitoring are as follows:

1. Display health status

2. Display build information number

3. Pay attention to and download log files

4 , View jvm system and environment properties

5, Easy log-level management

6, Interact with JMX-beans

7, View thread dump

8. View http tracking

9. Status change notification (via email, Slack, Hipchat,...)

10. Event log of status change (non-persistent)

......

2. Introduction to key integration

1. pom.xml statement

<properties>
    <java.version>1.8</java.version>
    <spring-boot-admin.version>2.3.1</spring-boot-admin.version>
</properties>

2. spring-boot-admin introduction

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>
<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>${spring-boot-admin.version}</version>
</dependency>
<dependency>
    <groupId>de.codecentric</groupId>
    <artifactId>spring-boot-admin-starter-server</artifactId>
    <version>${spring-boot-admin.version}</version>
</dependency>

3. Server configuration

server:
  # 服务器的HTTP端口,默认为8080
  port: 8085
# 日志配置
logging:
  # 已存在日志xml配置文件后,path与name 不生效
  config: classpath:logback.xml
spring:
  boot:
    admin:
      # Spring Boot Admin Server 服务端的相关配置
      context-path: /admin # 配置 Spring

4. Client configuration

spring:
  application:
    name: springboot-admin-monitor
  boot:
    admin:
      # Spring Boot Admin Client 客户端的相关配置
      client:
        # 设置 Spring Boot Admin Server 地址
        url: http://localhost:${server.port}${spring.boot.admin.context-path}
        instance:
          prefer-ip: true # 注册实例时,优先使用 IP
 
# Actuator 监控端点的配置项
management:
  endpoints:
    web:
      # Actuator 提供的 API 接口的根目录。默认为 /actuator
      base-path: /actuator
      exposure:
        # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
        include: '*'
  # 已存在日志xml配置文件后,需要配置该项
  endpoint:
    logfile:
      external-file: ./logs/sys-console.log

3. Related monitoring examples

1. Monitoring homepage

springboot admin监控的作用和使用方法是什么

2. View application monitoring information

springboot admin监控的作用和使用方法是什么

3. Real-time log output

springboot admin监控的作用和使用方法是什么

4. Dynamic adjustment Log level

springboot admin监控的作用和使用方法是什么

5, jvm

springboot admin监控的作用和使用方法是什么

The above is the detailed content of What is the role and usage of springboot admin monitoring. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete