spring boot admin系統監控處理

1.系統監控使用springboot admin

2.springboot admin server

2.1 修改pom.xml增長dependency

<dependency>
			<groupId>de.codecentric</groupId>
			<artifactId>spring-boot-admin-server</artifactId>
			<version>1.3.2</version>
		</dependency>
		<dependency>
			<groupId>de.codecentric</groupId>
			<artifactId>spring-boot-admin-server-ui</artifactId>
			<version>1.3.2</version>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>

2.2 啓動類SpringbootApplication增長admin註解支持

@SpringBootApplication
@EnableAutoConfiguration
@EnableAdminServer
public class SpringbootApplication {

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

}

2.3 修改屬性文件application.properties

server.display-name=springbootserver
server.context-path=/
server.servlet-path=/
server.port=8090
# admin
spring.boot.admin.url=http://localhost:${server.port}

3.springboot admin client

3.1 修改pom.xml增長dependency

<dependency>
			<groupId>de.codecentric</groupId>
			<artifactId>spring-boot-admin-starter-client</artifactId>
			<version>1.3.4</version>
		</dependency>
		<dependency>
			<groupId>org.jolokia</groupId>
			<artifactId>jolokia-core</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>

3.2 修改屬性文件application.properties

server.display-name=springbootserver
server.context-path=/
server.servlet-path=/
server.port=8090
# admin
spring.boot.admin.url=http://localhost:8090

3.3 logback.xml增長配置

<configuration>
	<include resource="org/springframework/boot/logging/logback/base.xml"/>
	<jmxConfigurator/>
</configuration>

啓動server和client便可查看應用的狀態

http://localhost:8090
相關文章
相關標籤/搜索