SpringBoot point of use Actuator monitored

Actuator is Springboot provide for the application of the system of self-examination and monitoring modules, by means of Actuator developers can easily monitor the index for some applications to view and statistics.
Adding pom file spring-boot-starter-actuator-dependent as follows:
  1. <dependency>
  2. <groupId>org.springframework.boot </groupId>
  3. <artifactId>spring-boot-starter-actuator </artifactId>
  4. </dependency>


  5. Actuator provides the main monitoring items. 


/ Autoconfig to view the use of auto-configuration, including: What is the application, which has not been applied and why they are not applied, which are excluded. 

/ Configprops can display a list of all @ConfigurationProperties sort of.

/ Beans can display information Spring container management of all the Bean. 

/ Dump applications to view all threads started, monitoring the content of each thread as shown in FIG. 

/ Env can view the configuration of the entire application, use / env / [name] you can see the specific configuration items. 

/ Health used to view the health status of the entire application, including disk space usage, database and caching of some health indicators. 

In addition, Springboot also allows users to customize health indicators, only we need to define a class that implements the interface HealthIndicator and incorporated into the management of the Spring container.  


   
   


  1. @Component


  2. public class MyHealthIndicator implements HealthIndicator{




  3. @Override


  4. public Health health() {


  5. return Health.down().withDetail( "error", "spring boot error").build();


  6. }




  7. }

/ Info can display all the configuration file to info. At the beginning or some configuration items associated with the Git configuration information.

/ Mappings to view the entire application URL address mapping information.  

/ Metrics used to view some of the basic indicators to monitor, you can use / metrics / [name] to see specific targets. 

/ Shutdown is a POST request to close the application, since the sensitive operation, the default request is prohibited in the case, to open the need to add the following configuration in the configuration file:  

endpoints.shutdown.enabled: true

/ Trace tracking information for monitoring all the requests, comprising: a request time, the request header, response header, and other information in response to time-consuming. 

Actuator monitoring and management

Open or closed

Actuator monitoring of all projects are defined in spring-boot-actuator-xxxRELEASE.jar of org.springframework.boot.actuate.endpoint package contains the following Endpoint. 

These are inherited from Endpoint AbstractEndpoint, AbstractEndpoint defines two important attributes: enabled and sensitive.

Wherein, enabled for opening or closing the monitored item, syntax is:. Endpoints [endpoint_name] .enabled = false / true, to close / autoconfig monitored item, for example, configured as follows. 

endpoints.autoconfig.enabled=false

sensitive items to configure the monitoring whether sensitive information, users need to have access to sensitive information ACTUATOR role permissions, use the following configuration or turn off security restrictions.  

management.security.enabled=false

Port and address

In addition to using the same application port access control address, we can also increase request management.port port configuration item to monitor their own designated in the configuration file. 

management.port=9090

Can also be specified by an IP address request monitor management.address configuration items, such as by only monitoring the machine, you may be provided management.address = 127.0.0.1.  

Guess you like

Origin www.cnblogs.com/doit8791/p/11470252.html