Spring Boot 2.x Actuator

Spring Boot includes many additional features to help you in the application monitoring and management applications into production. You can choose to use or HTTP endpoint JMX to manage and monitor your application automatically applied to the audit, and health indicators were collected.

Sentence: Spring Boot provides modules for monitoring and managing the production environment - Actuator

The official document: https://docs.spring.io/spring-boot/docs/2.1.0.BUILD-SNAPSHOT/reference/htmlsingle/#production-ready

We need to join rely

<dependency>  
  <groupId>org.springframework.boot</groupId>  
  <artifactId>spring-boot-starter-actuator</artifactId>  
</dependency> 

After addition depend above, several access url:

http://localhost:8080/actuator

http://localhost:8080/actuator/health

Note: Spring Boot difference between the old and new versions of access address: the endpoints adjusted by the base path / to / actuator. Such as: / info adjusted / actuator / info 

Actuator module provides some url, you can view the production of environmental information through these url, by / actuator View

Of course, more than that, as shown in the figure is only the default url provided (For security reasons, all actuators except / health and / info are disabled by default), which can be configured address can be accessed through the configuration file

Add the following configuration in the configuration file:

# Indicates open to all 
management.endpoints.web.exposure.include = *

Official website Description: https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-security-actuator

Recommendation: Before setting management.endpoints.web.exposure.include, be sure to expose the actuator does not contain sensitive information obtained; or context to completely remove the disabled endpoint from the application; or controlled by placing it in the firewall and not to be use; or managed by Spring Boot Admin; or to use their own scripting monitoring.

Spring Boot Admin relevant information: https://www.cnblogs.com/ityouknow/p/8440455.html

If you want to change the endpoint exposed by technology, use include and exclude attributes. Examples are as follows:

# Enable all: 
management.endpoints.web.exposure.include = * # open a:
management.endpoints.web.exposure.include metrics = # a close:
management.endpoints.web.exposure.exclude = metrics

Introduction of several commonly used

1) / health View application health indicators

2) / actuator / metrics to view a list of application basic indicators

3) / actuator / metrics / {name} via the list to view specific indicators

4) / actuator / env from a display attribute of the Spring ConfigurableEnvironment

 

Guess you like

Origin www.cnblogs.com/jwen1994/p/11391404.html