亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

您的位置:首頁技術(shù)文章
文章詳情頁

SpringBoot配置Actuator組件,實(shí)現(xiàn)系統(tǒng)監(jiān)控

瀏覽:6日期:2023-03-03 15:17:41
目錄一、Actuator簡介二、與SpringBoot2.0整合 1、核心依賴Jar包2、Yml配置文件三、監(jiān)控接口詳解 1、Info接口2、Health接口3、Beans接口4、Conditions接口5、HeapDump接口6、Mappings接口7、ThreadDump接口8、ShutDown接口四、源代碼地址 一、Actuator簡介

監(jiān)控分類

Actuator 提供Rest接口,展示監(jiān)控信息。 接口分為三大類: 應(yīng)用配置類:獲取應(yīng)用程序中加載的應(yīng)用配置、環(huán)境變量、自動化配置報告等與SpringBoot應(yīng)用相關(guān)的配置類信息。 度量指標(biāo)類:獲取應(yīng)用程序運(yùn)行過程中用于監(jiān)控的度量指標(biāo),比如:內(nèi)存信息、線程池信息、HTTP請求統(tǒng)計等。 操作控制類:提供了對應(yīng)用的關(guān)閉等操作類功能。二、與SpringBoot2.0整合 1、核心依賴Jar包

<!-- 監(jiān)控依賴 --><dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId></dependency>2、Yml配置文件

# 端口server: port: 8016spring: application: # 應(yīng)用名稱 name: node16-boot-actuatormanagement: endpoints: web: exposure:# 打開所有的監(jiān)控點(diǎn)include: '*' # 自定義監(jiān)控路徑 monitor # 默認(rèn)值:http://localhost:8016/actuator/* # 配置后:http://localhost:8016/monitor/* base-path: /monitor endpoint: health: show-details: always shutdown: # 通過指定接口關(guān)閉 SpringBoot enabled: true # 可以自定義端口 # server: # port: 8089# 描述項目基礎(chǔ)信息info: app: name: node16-boot-actuator port: 8016 version: 1.0.0 author: cicada三、監(jiān)控接口詳解 1、Info接口

Yml文件中配置的項目基礎(chǔ)信息

路徑:http://localhost:8016/monitor/info輸出:{ 'app': {'name': 'node16-boot-actuator','port': 8016,'version': '1.0.0','author': 'cicada' }}2、Health接口

health 主要用來檢查應(yīng)用的運(yùn)行狀態(tài)

路徑:http://localhost:8016/monitor/health輸出:{ 'status': 'UP', 'details': {'diskSpace': { 'status': 'UP', 'details': {'total': 185496236032,'free': 140944084992,'threshold': 10485760 }} }}3、Beans接口

展示了 bean 的類型、單例多例、別名、類的全路徑、依賴Jar等內(nèi)容。

路徑:http://localhost:8016/monitor/beans輸出:{ '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接口

查看配置在什么條件下有效,或者自動配置為什么無效。

路徑:http://localhost:8016/monitor/conditions輸出:{ 'contexts': {'node16-boot-actuator': { 'positiveMatches': {'AuditAutoConfiguration#auditListener': [{ 'condition': 'OnBeanCondition', 'message': '@ConditionalOnMissingBean'}], }}5、HeapDump接口

自動生成Jvm的堆轉(zhuǎn)儲文件HeapDump,可以使用監(jiān)控工具 VisualVM 打開此文件查看內(nèi)存快照。

路徑:http://localhost:8016/monitor/heapdump6、Mappings接口

描述 URI 路徑和控制器的映射關(guān)系

路徑:http://localhost:8016/monitor/mappings輸出:{ '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接口

展示線程名、線程ID、是否等待鎖、線程的狀態(tài)、線程鎖等相關(guān)信息。

路徑:http://localhost:8016/monitor/threaddump輸出:{ '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 } ]}8、ShutDown接口

優(yōu)雅關(guān)閉 Spring Boot 應(yīng)用,默認(rèn)只支持POST請求。

路徑:http://localhost:8016/monitor/shutdown四、源代碼地址

GitHub地址:知了一笑https://github.com/cicadasmile/spring-boot-base碼云地址:知了一笑https://gitee.com/cicadasmile/spring-boot-base

以上就是SpringBoot配置Actuator組件,實(shí)現(xiàn)系統(tǒng)監(jiān)控的詳細(xì)內(nèi)容,更多關(guān)于SpringBoot配置Actuator的資料請關(guān)注好吧啦網(wǎng)其它相關(guān)文章!

標(biāo)簽: Spring
主站蜘蛛池模板: 日本美女黄视频 | 性感美女在线喷水 | 日本久久黄色 | 草草免费观看视频在线 | 国产区香蕉精品系列在线观看不卡 | 国产精品入口麻豆高清 | 骚骚精品免费看 | 国产精品国产三级国产无毒 | 日韩精品视频免费 | 亚洲精品在线免费 | 91精品国产手机在线版 | 草操影院| 18岁免费网站 | 久久91亚洲人成电影网站 | 日本韩国欧美一区 | 狠狠插影院 | 老师的丰满大乳奶水视频 | 色婷婷综合在线 | 国产黄色毛片 | 久久综合一区二区三区 | 欧美成a人片免费看久久 | 亚洲综合精品香蕉久久网 | www.色婷婷| 欧美a视频在线观看 | 开心网五月色婷婷综合图片 | 高清影院在线欧美人色 | 国产情侣草莓视频在线 | 我想看黄色一级片 | 香蕉久久夜色精品国产2020 | 久久国产精品免费一区二区三区 | 婷婷久久综合九色综合九七 | 国产黄色a级 | a毛片免费播放全部完整 | 国产1024观看免费视频 | 一级黄色欧美 | 色综合久久丁香婷婷 | 麻豆视频一区 | 在线视频亚洲欧美 | 亚洲精品亚洲人成在线 | 精品在线99 | 49pao强力在线高清基地 |