The Actuator Spring Boot provides the capability to monitor the operational status of the monitoring data Actuator can be obtained by REST , remote shell (version 1.5 later abandoned) and JMX
in the way. We first introduced by the view node Actuator REST ways, this is the most common and simple method.
In the project's pom
introduction Actuator file starting rely on the Spring-the Boot-Starter-Actuator , the code list is as follows:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
In the configuration file application.yml
configuration management.port
and management.security.enabled
, equipped with two separate configurations Actuator exposure of foreign REST API
non-secure authentication port number of the interface and Actuator taken its code list is as follows:
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: always
shutdown:
enabled: true
server:
port: 9001
In the above configuration code specified in the Actuator exposed outside REST API
the port number of the interface as 9001, if not specified, the port is the port to start the application, purpose of this program is to separate monitoring ports and port procedures. Configuration management.endpoints.web.exposure.include
is set to "*" all nodes exposed Actuator assembly; configuration management.endpoint.shutdown
is set to "to true", open and can be closed by the request function. Start project, in the console you can see the following information:
[Pictures of foreign chains dump fails, the source station may have a security chain mechanism, it is recommended to save the picture down directly upload (img-aznyA0zr-1582192408624) (C: \ Users \ DuXiaobo \ AppData \ Roaming \ Typora \ typora-user-images \ 1580874829607.png)]
From the above information, Actuator Spring Boot monitor port is 9001.
Actuator Spring Boot key features is to provide a large number of nodes in the Web application, the real-time understanding of application health through these nodes. With Actuator, you can know Bean in Spring application contexts is how to assemble together, and you can get a measure of information and runtime environment properties and so on.
Types of | API port | description |
---|---|---|
GET | /autoconfig | The endpoint used to obtain configuration report automation applications, including automated configuration of all the candidates. It also lists the prerequisites for automated configuration of each candidate meets. Therefore, the endpoint can help us to easily find the specific reasons why some automated configuration no effect. The contents of the report will automate the configuration is divided into two parts:
|
GET | /configprops | Description configuration properties (default values)
|
GET | /beans | Description of the application in the context of all of the Bean, as well as their relationship
|
GET | /threaddump | Take a snapshot of the thread activity |
GET | /env | Gets all the available application environment property report. Comprising: a variable environment, the JVM properties, configuration of the application configuration, the command line parameters |
GET | /env/{name} | Attribute value to obtain the specific environment under the name / env interface can also be used to obtain the value of a single attribute, only when the request / env can add attribute name |
GET | /sessions | User Session |
GET | /health | Application of health indicators |
GET | /info | This endpoint information is used to return some custom applications. By default, the endpoint will return an empty json content we can set some properties by info prefix application.properties profile |
GET | /auditevents | Displays the current audit events in the application of information |
GET | /conditions | Status display configuration and autoconfiguration classes classes, and why they are applied or not applied |
GET | /flyway | Display Database migration path |
GET | /liquibase | Liquibase show any data migration path (if present) |
GET | /loggers | Display and set the Logger level |
GET | /mappings | Description of all of the URI path, and they and the controller (included Actuator endpoints) set out the mapping between the application interfaces all released
|
GET | /metrics | Metric information reporting various applications, such as memory usage, HTTP request count, thread information, garbage collection information
|
GET | /scheduledtasks | 显示应用程序中的计划任务 |
GET | /httptrace | 提供基本的HTTP请求跟踪信息(时间戳、HTTP头等)。 默认情况下,跟踪信息的存储采用org.springframework.boot.actuate.trace.InMemoryTraceRepository实现的内存方式,始终保留最近的100条请求记录 |
GET | /caches | 暴露可用缓存 |
POST | /shutdown | 关闭应用程序,需要将management.endpoint.shutdown设置为true |