Spring Boot Actuator Brief

Source: Internet
Author: User
Tags spring boot actuator

Spring boot internally provides a spring-boot-actuator module for monitoring and managing spring boot applications.

How do I use the Spring-boot-actuator module?

Maven adds Spring-boot-actuator's start POMs

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

Then start the project, access the address http://localhost:8080/health, and see the following page:

{
    status: ' Up ',
    diskspace: {
        status: ' Up ',
        total:249779191808,
        free:22231089152,
        threshold:10485760
    },
    db: {
        status: "Up",
        database: "H2",
        hello:1
    }
}

This/health endpoint shows some of the health conditions that are currently applied.

Which dimensions of Spring boot are monitored from.

Spring provides a number of endpoints (endpoint) to monitor different dimensions, with some common endpoints listed below

/beans See what beans are in the spring factory

/dump all thread states in an application

/env information about the application environment

/mappings SPRINGMVC's request mapping mapping information

/configprops Spring configuration information such as data source spring configuration information

/metrics Metric Information

/health access to various health conditions

/info Display current app information

For details, refer to the documentation for the spring boot document

These are the native endpoints of Spring boot actuator


How do I turn off endpoints and set endpoints?

Custom endpoints are set by the endpoints+ end name + attribute names, separated by each segment.

1. You can modify the endpoint ID

Endpoints.beans.id=mybeans

The access address becomes http://localhost:8080/mybeans.

2. Turn on the endpoint

Endpoints.shutdown.enabled=true

3. Close the Endpoint

Close the Beans Endpoint

Endpoints.beans.enabled=false

4. Open only the desired endpoint

If only the desired endpoint is turned on, we can do so by closing all the endpoints and then opening the desired endpoint, for example

Endpoints.enabled=false

Endpoints.beans.enabled=true


Note: Sometimes the management port is protected by the firewall, will be reported 401 no access, this time can be configured

Management.security.enabled=false

To disable security management





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.