Admin Monitoring App
The monitoring interfaces provided by Spring boot, such as/health,/info, etc., in fact, in addition to the information previously mentioned, there are other information industries that need to be monitored: the number of sessions currently active, the number of concurrent applications currently in use, the latency, and other metric information. Let's look at how to use Spring-boot-admin to monitor our system.
Admin-server-ui
pom.xml
Configuration:
- <parent>
- <groupId>org.springframework.boot</groupId>
- <artifactid>spring-boot-starter-parent</artifactid>
- <version>1.4.3.release</version>
- <relativepath/>
- </parent>
- <dependencymanagement>
- <dependencies>
- <dependency>
- <groupId>org.springframework.cloud</groupId>
- <artifactid>spring-cloud-dependencies</artifactid>
- <version>CAMDEN.SR5</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencymanagement>
- <dependencies>
- <dependency>
- <groupId>org.springframework.cloud</groupId>
- <artifactid>spring-cloud-starter-eureka</artifactid>
- </dependency>
- <dependency>
- <groupId>de.codecentric</groupId>
- <artifactid>spring-boot-admin-server</artifactid>
- <version>1.4.5</version>
- </dependency>
- <dependency>
- <groupId>de.codecentric</groupId>
- <artifactid>spring-boot-admin-server-ui</artifactid>
- <version>1.4.5</version>
- </dependency>
- </dependencies>
- Note Version number (1.5.2+1.5.7)
application.properties
Configuration:
- Spring. Application. Name=admin-ui
- Info. version=@project. Version@
- Server. port=8080
- Eureka. Clientserviceurl. Defaultzone=http://localhost:8888/eureka/
Java code:
- @SpringBootApplication
- @EnableDiscoveryClient
- @EnableAdminServer
- public class adminapplication {
- public static void main(string[] args) {
- Springapplication.run (Adminapplication.class, args);
- }
- }
logback-spring.xml
Configuration:
- <?xml version="1.0" encoding="UTF-8"?>
- <configuration>
- <include resource="Org/springframework/boot/logging/logback/base.xml"/ >
- <jmxconfigurator/>
- </configuration>
Add other items to be monitored
Added to the monitored service pom.xml
:
- <!--
- the spring-boot-starter-actuator contained in the spring-boot-admin-starter-client is used to collect service information
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-actuator</artifactId>
- </dependency>
- -
- <dependency>
- <groupId>de.codecentric</groupId>
- <artifactid>spring-boot-admin-starter-client</artifactid>
- <version>1.4.5</version>
- </dependency>
application.properties
Increase:
- # Turn off secure access
- management.security.enabled=false
- # If the monitored service is not registered to the service center, you need to add the admin address
- # spring.boot.admin.url=http://localhost:8888
Increase logback-spring.xml
:
- <?xml version="1.0" encoding="UTF-8"?>
- <configuration>
- <include resource="Org/springframework/boot/logging/logback/base.xml"/>
- <jmxconfigurator/>
- </configuration>
- The details page of a single service, others do not repeat.
Turn from: 79708622
Springcloud--admin Monitoring use