spring boot actuator can monitor various information of applications. The only disadvantage is that the monitoring information returned is JSON format data. Another point is that under the microservice architecture, there will be many service instances, and it seems a bit unlikely to view monitoring information one by one. Moreover, so many address information can only be found in Eureka. Is there a function that can centrally manage the service information in Eureka, and can view the monitoring information provided by actuator through the interface. It is Spring Boot Admin.
Introduction to Spring Boot Admin
spring boot admin github open source address: https://github.com/codecentric/spring-boot-admin
Its main function is to provide a simple WEB UI display based on Spring Boot Actuator.
First, create an admin project and 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 a startup class
/** * Program Monitoring* * @author yinjihuan * @create 2017-11-28 15:26 **/@Configuration@EnableAutoConfiguration@EnableDiscoveryClient@EnableAdminServerpublic class AdminApplication { public static void main(String[] args) { SpringApplication.run(AdminApplication.class, args); }}Configure the address of Eureka, you need to go to Eureka to obtain registered service information
spring.application.name=fangjia-boot-adminserver.port=9101eureka.client.serviceUrl.defaultZone=http://goojia:goojia123456@master:8761/eureka/eureka.instance.preferIpAddress=trueeurek a.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 access the service address to see the page below
[Image upload failed...(image-737ba5-1513042852782)]
You can see all registered service information and service status on this page. Click on the details to see the specific monitoring information
[Image upload failed...(image-bbb4bd-1513042852782)]
You can also see log information in the second submenu, but the logging.file address must be configured in the service so that the log content can be read here.
For specific code, please refer to my github: https://github.com/yinjihuan/spring-cloud
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.