Steps for monitoring management
By introducingspring-boot-starter-actuator, you can use springboot to provideApplication monitoringandAdministrationFunction of sureOperate through HTTP, JMX and SSH protocols to automatically obtain audit, health and index information
- Introducing spring boot starter actuator
- Access the monitoring endpoint via http
- You can perform shutdown and post submission. This endpoint is closed by default
1. Create the springboot project, introduce the web package, devtools package (project hot deployment), and the actuator package under ops
2. Configuration file management security. enabled=false
Monitoring and managing endpoints
Endpoint name | describe |
---|---|
autoconfig | All auto configuration information |
auditevents | Audit information |
beans | Information about all beans |
configprops | All configuration properties |
dump | Thread status information |
env | Current environment information |
health | Application health |
info | Current application information |
metrics | Applied indicators |
mappings | Apply @ requestmapping mapping mapping path |
shutdown | Close the current application (closed by default) |
trace | Tracking information (latest HTTP request) |
Custom endpoint information
-
Custom endpoint throughEndpoints + endpoint name + attribute nameset up
- Modify endpoint ID: endpoints.beans.id=mybeans
- Enable remote application shutdown function: endpoints.shutdown.enable=true
- Close endpoint: endpoints.beans.enabled=false
-
Open the desired endpoint:
- endpoints. Enabled = false (close all endpoint access)
- endpoints.beans.enabled=true
-
Custom endpoint access path:
- management. Context path = / manage (customize the access paths of all endpoints)
- endpoints.beans.path=/bean
- Custom endpoint port number: management.port=8989
-
Close HTTP endpoint: management.port=-1
Health endpoint
- Check the health of the connected app configuration(status=”up”/status=”down”)
-
Custom health indicator:
- Create an indicator class and implement the healthindicator interface: health up(). Build () stands for health, health down(). withDetail(“msg”,”xxx”). Build () stands for health
- Name format of indicator: xxxhealthindicator
- Label @ component to add the indicator to the container