Spring Boot Admin manages monitoring data

Posted by mdnghtblue on Tue, 09 Jun 2020 18:56:02 +0200

The spring boot actuator monitors information about the application.The only disadvantage is that the monitoring information returned is data in JSON format. Another is that under the micro-service architecture, there are many instances of services, it seems impossible to see the monitoring information one by one, and so much address information can only be found in Eureka. Is there a function that can centrally manage the service information in Eureka and can be through the interface?Type to view the monitoring information provided by the actuator, which is Spring Boot Admin.

First, create an admin project to add the required dependency information:

<dependency>
    <groupId>de.codecentric</groupId>
    <artifactId>spring-boot-admin-server</artifactId>
    <version>1.5.5</version>
</dependency>
<dependency>
    <groupId>de.codecentric</groupId>
    <artifactId>spring-boot-admin-server-ui</artifactId>
    <version>1.5.5</version>
</dependency>
<dependency>
    <groupId>de.codecentric</groupId>
    <artifactId>spring-boot-admin-server-ui-login</artifactId>
    <version>1.5.5</version>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>

Create Startup Class

/**
 * Program Monitoring
 *
 * @author yinjihuan
 * @create 2017-11-28 15:26
 **/
@Configuration
@EnableAutoConfiguration
@EnableDiscoveryClient
@EnableAdminServer
public class AdminApplication {
    public static void main(String[] args) {
        SpringApplication.run(AdminApplication.class, args);
    }
}

To configure Eureka's address, you need to go to Eureka to get registered service information

spring.application.name=fangjia-boot-admin
server.port=9101

eureka.client.serviceUrl.defaultZone=http://goojia:goojia123456@master:8761/eureka/
eureka.instance.preferIpAddress=true
eureka.instance.instance-id=${spring.application.name}:${spring.cloud.client.ipAddress}:${server.port}
eureka.instance.status-page-url=http://${spring.cloud.client.ipAddress}:${server.port}

Start the project and visit the service address to see the following page
[Picture upload failed... (image-737ba5-1513042852782)]

On this page you can see all registered service information and the status of the service. Click on the details to see the specific monitoring information

[Picture upload failed... (image-bbb4bd-1513042852782)]

The second submenu can also see log information, but the service must be configuredLogging.fileAddress so that this side can read the log content

The code can refer to my github:

https://github.com/yinjihuan/spring-cloud

Topics: Spring github JSON