In a production environment, the availability of services needs to be monitored in real time or regularly. Spring Boot's Actuator (health monitoring) feature provides many of the interfaces required for monitoring, configuration viewing of application systems, and related function statistics.
Integration:
< Dependency > < groupId >org.springframework.boot</groupId> < Artifactid>spring-boot-starter-actuator</artifactid> </dependency>
This dependency is also required if the HTTP call is used:
< Dependency > < groupId >org.springframework.boot</groupId> < Artifactid>spring-boot-starter-web</artifactid> </dependency>
Configuration:
The HTTP port specified in APPLICATION.YML (if not specified, uses the same port as the server); Specifies that a check is removed (such as not monitoring Health.mail):
Server: 8082 Management: 54001 Health : Mail: enabled:false
Use:
http Method |
Path |
Description |
Authentication |
GET |
/autoconfig |
View the usage of automatic configuration |
True |
GET |
/configprops |
View configuration properties, including default configuration |
True |
GET |
/beans |
View a list of beans and their relationships |
True |
GET |
/dump |
Print thread stacks |
True |
GET |
/env |
View all environment variables |
True |
GET |
/env/{name} |
View specific variable values |
True |
GET |
/health |
View App Health Metrics |
False |
GET |
/info |
View app information (you need to add information to your application.properties, such as [email protected]) |
False |
GET |
/mappings |
View all URL mappings |
True |
GET |
/metrics |
View App Basic Metrics |
True |
GET |
/metrics/{name} |
View specific metrics |
True |
POST |
/shutdown |
Close the app (to really take effect, the profile opens Endpoints.shutdown.enabled:true) |
True |
GET |
/trace |
View basic tracking information |
True |
Maven Example:
Https://github.com/easonjim/spring-cloud-demo/tree/master/ZooKeeper
Reference:
1190000004318360?_ea=568366
http://blog.csdn.net/clementad/article/details/52045495
http://www.jianshu.com/p/734519d3c383
Spring-boot-starter-actuator (health monitoring) configuration and use