The Admin profile

Spring Boot Admin is the background interface for monitoring and managing the running status of Spring Boot applications. The latest UI is rewritten using vue.js.

Spring Boot Admin provides rich monitoring o&M functions for registered applications. As follows:

  • Show health
  • Displays detailed application runtime information, such as JVM and memory metrics
  • Counters and measurement indicators
  • Data source metric
  • Cache measure
  • Trace and download log files
  • View JVM system and environment properties
  • One-click LogLevel management
  • Manage jMX-Beans execution
  • Viewing a thread dump
  • Viewing Trace Information
  • Hystrix-dashboard Integration (integration removed for version 2.x)
  • Download heapdumps
  • Status change notification (support: email, Slack, Hipchat, etc.)
  • State change event log (non-permanent)

More details can be found in the documentation.

Admin Use and configuration

Spring Boot Admin server

Project depend on

<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <! -- admin-server --> <dependency> <groupId>de.codecentric</groupId> < artifactId > spring - the boot - admin - starter - server < / artifactId > < version > 2.1.6 < / version > < / dependency >Copy the code

Start the Admin Server

@SpringBootApplication @EnableAutoConfiguration @EnableAdminServer public class SpringBootAdminApplication { public static void main(String[] args) { SpringApplication.run(SpringBootAdminApplication.class, args); }}Copy the code

Application. The properties configuration

server.port=9000
spring.application.name=Spring Boot Admin Web
Copy the code

test

To launch the project, visit http://127.0.0.1:9000 in your browser

Spring Boot Admin client

Take the Spring Boot Actuator project above as an example

Project depend on

<! -- admin-client --> <dependency> <groupId>de.codecentric</groupId> < artifactId > spring - the boot - admin - starter - client < / artifactId > < version > 2.1.6 < / version > < / dependency >Copy the code

Application. The properties configuration

Set Admin Server addressServer port = 8080 spring. Application. Name = spring Boot physical Demo spring. The Boot. Admin. Client. Url = http://127.0.0.1:9000Copy the code

test

Start the project, visit http://127.0.0.1:9000 through the browser, and we will see the corresponding client application displayed in Applications on the management interface of Spring Boot Admin. Click Application to enter the detailed monitoring interface.

Spring Boot Admin Configures properties

Spring Boot Admin Server Configuration attributes

attribute describe The default value
spring.boot.admin.context-path Context paths are prefixed to paths that should serve Admin Server’s static assets and apis. Relative to the Dispatcher Servlet /
spring.boot.admin.monitor.status-interval Interval for updating the client status, in milliseconds 10000
spring.boot.admin.monitor.status-lifetime The lifetime of the client state, in milliseconds, during which the client state is not updated 10000
spring.boot.admin.monitor.connect-timeout The connection times out when the client status is queried, in milliseconds 2000
spring.boot.admin.monitor.read-timeout Timeout period for reading client status information, in milliseconds 10000
spring.boot.admin.monitor.default-retries Default number of retries for failed requests. Modyfing requests (PUT, POST, PATCH, DELETE) will never be retried 0
spring.boot.admin.monitor.retries.* Key-value pairs with the number of retries per endpointId. The default is default retry. Modyfing requests (PUT, POST, PATCH, DELETE) will never be retried
spring.boot.admin.metadata-keys-to-sanitize Metadata to be filtered out (this data is filtered out of the output JSON data when matched with the regular expression) “.password“, “.*keytoken
spring.boot.admin.probed-endpoints Client endpoint information to be obtained “health”, “env”, “metrics”, “httptrace:trace”, “threaddump:dump”, “jolokia”, “info”, “logfile”, “refresh”, “flyway”, “liquibase”, “heapdump”, “loggers”, “auditevents”
spring.boot.admin.instance-proxy.ignored-headers Headers information that will not be forwarded when a client sends a request “Cookie”, “Set-Cookie”, “Authorization”
spring.boot.admin.ui.public-url The base URL used to build the base href in the UI If running behind a reverse proxy (using path rewriting), it can be used for proper self-reference. If the host/port is omitted, it will be inferred from the request
spring.boot.admin.ui.brand The brand displayed in the navigation bar <img src="assets/img/icon-spring-boot-admin.svg"><span>Spring Boot Admin</span>
spring.boot.admin.ui.title The page title “Spring Boot Admin”
spring.boot.admin.ui.favicon An icon used as a default icon for desktop notifications “assets/img/favicon.png”
spring.boot.admin.ui.favicon-danger Used as a website icon when one or more services are down and used for desktop notifications “assets/img/favicon-danger.png”

Spring Boot Admin Client Configuration attributes

attribute describe The default value
spring.boot.admin.client.enabled Enable the Spring Boot Admin Client true
spring.boot.admin.client.url Url of the server to be registered. If multiple server ports need to be registered at the same time, separate the URLS of each server with commas (,)
spring.boot.admin.client.api-path Manage the Http path of the registered endpoint on the server “instances”
spring.boot.admin.client.username If the server requires authentication, this attribute is used to configure the user name
spring.boot.admin.client.password If authentication is required on the server, this attribute is used to configure the password
spring.boot.admin.client.period Time interval for repeated registration (in milliseconds) 10000
spring.boot.admin.client.connect-timeout Timeout for connection registration in milliseconds 5000
spring.boot.admin.client.read-timeout Read registration timeout (in milliseconds) 5000
spring.boot.admin.client.auto-registration If set to true, the scheduled task of registering the application is automatically scheduled when the application is ready true
spring.boot.admin.client.auto-deregistration When the context is off, switch to enabling automatic decryption on the Spring Boot Admin server. If this value is not set and the feature is active when a running CloudPlatform is detected null
spring.boot.admin.client.register-once If set to true, the client will only be registered to a management server (by definition spring. The boot. Admin. The instance. The url); If this administration server fails, the next administration server is automatically registered. If false, it registers with all administrative servers true
spring.boot.admin.client.instance.health-url Health-url address to register. It can be overridden if the accessible URL is different (for example, Docker). Must be unique in the registry By default, this value is associated with management-URL and endpoint.health. id. For example, in the project, the value is: HealthUrl = http://127.0.0.1:8080/actuator/health, http://127.0.0.1:8080/actuator is management – the url, The health is endpoints. Health. Id
spring.boot.admin.client.instance.management-base-url The base URL used to calculate the administrative URL to register. The path is inferred at run time and attached to the base URL By default, the value is related to management. Port, service-url, and server. servlets-path. For example, the value is http://127.0.0.1:8080. 127.0.0.1 is the configured service-url value, or the configured server.servlet-path (the project startup path) if service-url is not set.
spring.boot.admin.client.instance.management-url Management-url to register. It can be overridden if the accessible URL is different (for example, Docker) Default the attribute value and management – base – the url and management context – path two attribute values, such as managementUrl = http://127.0.0.1:8080/actuator, http://127.0.0.1:8080 is management-base-URL, and /actuator is management-context-path
spring.boot.admin.client.instance.service-base-url The base URL used to calculate the service URL to register. The path is inferred at run time and attached to the base URL The default value is related to hostname and server.port, for example, http://127.0.0.1:8080, where port 8080 is the configured server.port. 127.0.0.1 is the hostname of the client server
spring.boot.admin.client.instance.service-url The url of the service to register. It can be overridden if the accessible URL is different (for example, Docker) The default value is service-base-URL and server.context-path
spring.boot.admin.client.instance.name The name to register The default value is the configured value of spring.application.name, or if this property is not configured, the default value is spring-boot-application
spring.boot.admin.client.instance.prefer-ip Use IP addresses instead of host names in guessed urls. If server.address/ management. Address is set, it will be used. Otherwise, inetaddress.getLocalhost () will use the IP address returned from it false
spring.boot.admin.client.instance.metadata.* The metadata key-value pair to be associated with this instance
spring.boot.admin.client.instance.metadata.tags.* Flag as the key-value pair to be associated with this instance

The sample code

github

Yards cloud

The document reference

Codecentric. Making. IO/spring – the boot…

The copyright of this article belongs to Chaowu And Qinghan, please indicate the source.

Spring Boot 2.x (x17) : Use and configure Spring Boot Admin for application monitoring

The original address: https://www.zwqh.top/article/info/26

If the article is helpful to you, please scan the code to pay attention to my public number, the article continues to update…