How to realize Service Monitoring by SpringBootAdmin+actuator
In this article, the editor introduces in detail "how to achieve service monitoring by SpringBootAdmin+actuator". The content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to achieve service monitoring with SpringBootAdmin+actuator" can help you solve your doubts.
SpringBootAdmin can monitor SpringBoot clicks or cluster projects, providing detailed health information, memory information, JVM system and environment properties, garbage collection information, log settings and viewing, timing task viewing, SpringBoot cache viewing and management functions.
Step 1: build the monitoring server
Create a SpringBoot project and add the following dependencies
Org.springframework.boot spring-boot-starter-web de.codecentric spring-boot-admin-starter-server
Enable the monitoring service on the startup class
Import de.codecentric.boot.admin.server.config.EnableAdminServer;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication; @ EnableAdminServer@SpringBootApplicationpublic class SysadminApplication {public static void main (String [] args) {SpringApplication.run (SysadminApplication.class, args); System.out.println ("Project started successfully!") ;}}
Only one service port needs to be configured in the configuration file. The purpose of configuring ports is not to conflict with other services.
Server.port=8081
Start the server, and visit the address: http://localhost:8081/applications interface as follows
Step 2: client build configuration
1. Required dependence
De.codecentric spring-boot-admin-starter-client org.springframework.boot spring-boot-starter-actuator
2. Add the following configuration to the client configuration file
Note: if it is a yml configuration file, when monitoring all items is enabled in the configuration, * you need to wrap it in single quotation marks
# current project port number, server.port=8080# Spring Boot Admin monitoring server address, spring.boot.admin.client.url= http://localhost:8081#, enable monitoring all items, Actuator function management.endpoints.web.exposure.include=*
3. Start the project and use the server home page address to view the http://localhost:8081/applications.
After reading this, the article "how to achieve Service Monitoring with SpringBootAdmin+actuator" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself. If you want to know more about related articles, you are welcome to follow the industry information channel.