Spring Boot provides runtime application monitoring and management functions, which we can operate through http, JMX, and SSH protocols.
Monitor and manage endpointsendpoint name | Depiction |
actuator | List of all EndPoints, need to add springHATEOAS support |
autoconfig | All autoconfigurations are currently applied |
beans | Information about all beans in the current application |
configprops | All configuration properties in the current application |
dump | Display current application thread status information |
env | Display the current environment information of the current application |
health | State of health |
info | Display current application information |
metrics | Information on various indicators |
mappings | Show all @RequestMapping mapped paths |
shutdown | Close the current application, closed by default |
trace | Display tracking information, the default is the latest http request |
1, HTTP
pom.xml add:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency>
测试e.g. http://localhost:8080/actuator, xxx/autoconfig
1), custom endpoint
Generally set by endPoints + endpoint name + attribute name, each segment is separated by ","
Modify the endpoint id: endpoint.beans.id=mybeans
Access becomes: http://localhost:8080/mybeans
2), custom endpoint
When the endpoints provided by spring boot cannot meet our special needs, we need to customize one.
You need to inherit the implementation class of AbstractEndpoint and register it as a Bean
3), custom HealthIndicator
Implement the HealthIndicator interface class
2, JMX
Call java's built-in jconsole in the console to implement JMX monitoring
cmd ---> jconsole, a monitoring window will pop up
3, SSH
This is achieved by spring with the help of CraSH ( http://www.crashub.org ).
Just add the spring-boot-starter-remote-shell dependency to the project
1), run
When starting the program, the console will print the SSH access password, which can be accessed using puTTY, SecureCRT, etc.
host: localhost
Port: 2000
Account: user
Password: console output as above
2), common commands
help, metrics, endpoint health
3), custom login user
Customize the following properties in application.properties
shell.auth.simple.user.name=xxxx
shell.auth.simple.user.password=xxxx
4), extended command
Available in spring-boot-starter-remote-shell.jar