In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to configure Actuator components in SpringBoot2" related knowledge, editor through the actual case to show you the operation process, the method of operation is simple and fast, practical, I hope that this "how to configure Actuator components in SpringBoot2" article can help you solve the problem.
A brief introduction to Actuator 1. The role of monitoring components
In a production environment, you need to monitor the availability of services in real time or on a regular basis. The actuator (Health Monitoring) function of Spring Boot provides many interfaces needed for monitoring, which can view the configuration of the application system, statistics related functions, and so on.
2. Monitoring classification
Actuator provides Rest interface to display monitoring information.
Interfaces are divided into three categories:
Application configuration class: get application configuration, environment variables, automation configuration reports and other configuration class information related to SpringBoot applications loaded in the application.
Metrics class: get the metrics used for monitoring during the running of the application, such as memory information, thread pool information, HTTP request statistics, etc.
Operation control class: provides operation class functions such as closing the application.
Second, integrate with SpringBoot2.0. 1. The core relies on Jar package org.springframework.boot spring-boot-starter-actuator2, Yml configuration file # Port server: port: 8016spring: application: # Application name name: node16-boot-actuatormanagement: endpoints: web: exposure: # Open all monitoring points include: "*" # Custom monitoring path monitor # default: http://localhost:8016/actuator/* # after configuration: http://localhost : 8016 app monitorUniverse * base-path: / monitor endpoint: health: show-details: always shutdown: # disable SpringBoot enabled: true through the specified interface # you can customize the port # server: # port: 808 describe the basic information of the project info: app: name: node16-boot-actuator port: 8016 version: 1.0.0 author: cicada Detailed explanation of monitoring interface 1. Info interface
Basic project information configured in the Yml file
Path: http://localhost:8016/monitor/info output: {"app": {"name": "node16-boot-actuator", "port": 8016, "version": "1.0.0", "author": "cicada"} 2, Health interface
Health is mainly used to check the running status of applications.
Path: http://localhost:8016/monitor/health output: {"status": "UP", "details": {"diskSpace": {"status": "UP", "details": {"total": 185496236032, "free": 140944084992 "threshold": 10485760} 3, Beans interface
Shows the type of bean, singleton multiple instances, aliases, full path of the class, dependency Jar, and so on.
Path: http://localhost:8016/monitor/beans output: {"contexts": {"node16-boot-actuator": {"beans": {"endpointCachingOperationInvokerAdvisor": {"aliases": [], "scope": "singleton", "type": "org.springframework.boot.actuate.endpoint.invoker.cache.CachingOperationInvokerAdvisor" "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/EndpointAutoConfiguration.class]", "dependencies": ["environment"]} 4, Conditions interface
See under what conditions the configuration is valid, or why the automatic configuration is invalid.
Path: http://localhost:8016/monitor/conditions output: {"contexts": {"node16-boot-actuator": {"positiveMatches": {"AuditAutoConfiguration#auditListener": [{"condition": "OnBeanCondition", "message": "@ ConditionalOnMissingBean"}],}} 5, HeapDump API
Automatically generate a heap dump file HeapDump for Jvm, which can be opened using the monitoring tool VisualVM to view memory snapshots.
Path: http://localhost:8016/monitor/heapdump6, Mappings API
Describe the mapping relationship between URI path and controller
Path: http://localhost:8016/monitor/mappings output: {"contexts": {"node16-boot-actuator": {"mappings": {"dispatcherServlets": {"dispatcherServlet": [{"handler": "Actuator web endpoint 'auditevents'" "predicate": "{GET / monitor/auditevents | | application/json]}" Details: {"handlerMethod": {"className": "org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping.Operat" name ":" handle " "descriptor": "Ljavax/servlet/http/HttpServletRequest Ljava/util/Map;) Ljava/lang/Object "}," requestMappingConditions ": {" consumes ": []," headers ": []," methods ": [" GET "] "params": [], "patterns": ["/ monitor/auditevents"], "produces": [{"mediaType": "application/vnd.spring-boot.actuator.v2+json" "negated": false}, {"mediaType": "application/json" "negated": false}]} 7, ThreadDump interface
Show the thread name, thread ID, whether to wait for the lock, thread status, thread lock and other related information.
Path: http://localhost:8016/monitor/threaddump output: {"threads": [{"threadName": "DestroyJavaVM", "threadId": 34, "blockedTime":-1, "blockedCount": 0, "waitedTime":-1, "waitedCount": 0, "lockName": null, "lockOwnerId":-1, "lockOwnerName": null "inNative": false, "suspended": false, "threadState": "RUNNABLE", "stackTrace": [], "lockedMonitors": [], "lockedSynchronizers": [], "lockInfo": null}]} the content of "how to configure Actuator components in SpringBoot2" ends here. Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.