springboot monitors Actuator settings

springboot monitoring Actuator

The monitoring center is to look at changes in server memory (for memory, threads, log management, etc.) Bean), statistics SpringMVC@RequestMapping (statistic http interface). Use Actuator to view these information, it returns
data in json format without interface
Interface
Monitoring Center Application Scenario: The reason why it is used in the production environment
is that it is an additional function of springboot, which can help you monitor and manage applications in the application production environment. Various requests using Http can be used to monitor, audit, and collect The running status of the application is very meaningful, especially for microservice management.
It is recommended to use springboot2.0.5 because the information returned in it is more comprehensive.

Springboot provides monitoring functions for projects.

1. First add the dependency package

<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-actuator -->
<dependency>
     <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
   <version>2.1.3.RELEASE</version>
</dependency>

2. Browser access
such as
http://127.0.0.1:8080/actuator/health to access project monitoring needs to be prefixed with /actuator
insert image description here
insert image description here

Because the actuator only supports endpoints /health and /info by default, a 404 page will appear when accessing /env.

3. Configure the endpoint
Configure the endpoint in application.properties,

暴露部分端点

management.endpoints.web.exposure.include=info,health,beans,env

暴露所有端点

management.endpoints.web.exposure.include=*

不暴露beans端点

management.endpoints.web.exposure.exclude=beans

In the above configuration, first use management.endpoints.web.exposure.include to expose all endpoints, and then use management.endpoints.web.exposure.exclud to exclude en endpoints, so that all actuator endpoints except env can be exposed.

4. Endpoint description
insert image description here

5. Other endpoint configurations

# Actuator 管理端口
management.server.port=8000
#暴露 有端
management.endpoints.web.exposure.include =女
#默认情况下 有端点都不启用,此时需要按需启用端点
management.endpoints.enabled-by-default=false 
#启用端点 info
management.endpoint.info.enabled=true 
#启用端点 beans
management.endpoint.beans.enabled=true 
#启用端点 configprops 
management.endpoint.configprops.enabled=true 
#启用端点 env
management.endpont.env.enabled=true
#启用端点 health
management.endpoint.health.enabled=true 
#启用端点 mappings
management.endpont.mappings.enabed=true
#启用端点 shutdown
management.endpoint.shutdown.enabled=true 
# Actuator 端点前缀
management.endpoints.web.base -path=/manage 
#将原来的 mappings 端点的请求路径修改为 urlMappings
management.endpoints.web.path-mapping.mappings=request_mappings
# Spring MVC 视图解析器配置
spring.mvc.view.prefix=/WEB-INF/jsp/ 
spring.mvc.view.suffix=.Jsp

Reprinted from https://www.cnblogs.com/ming-blogs/p/10697033.html

Guess you like

Origin blog.csdn.net/munangs/article/details/123639480