内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

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

這篇文章主要介紹“SpringBoot怎么配置Actuator組件實現(xiàn)系統(tǒng)監(jiān)控”的相關(guān)知識,小編通過實際案例向大家展示操作過程,操作方法簡單快捷,實用性強,希望這篇“SpringBoot怎么配置Actuator組件實現(xiàn)系統(tǒng)監(jiān)控”文章能幫助大家解決問題。

創(chuàng)新互聯(lián)公司專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于做網(wǎng)站、成都網(wǎng)站建設(shè)、臨城網(wǎng)絡(luò)推廣、微信小程序定制開發(fā)、臨城網(wǎng)絡(luò)營銷、臨城企業(yè)策劃、臨城品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運營等,從售前售中售后,我們都將竭誠為您服務(wù),您的肯定,是我們最大的嘉獎;創(chuàng)新互聯(lián)公司為所有大學(xué)生創(chuàng)業(yè)者提供臨城建站搭建服務(wù),24小時服務(wù)熱線:028-86922220,官方網(wǎng)址:www.rwnh.cn

    一、Actuator簡介

    監(jiān)控分類

    • Actuator 提供Rest接口,展示監(jiān)控信息。

    • 接口分為三大類:

    • 應(yīng)用配置類:獲取應(yīng)用程序中加載的應(yīng)用配置、環(huán)境變量、自動化配置報告等與SpringBoot應(yīng)用相關(guān)的配置類信息。

    • 度量指標類:獲取應(yīng)用程序運行過程中用于監(jiān)控的度量指標,比如:內(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: 8016
    
    spring:
      application:
        # 應(yīng)用名稱
        name: node16-boot-actuator
    
    management:
      endpoints:
        web:
          exposure:
            # 打開所有的監(jiān)控點
            include: "*"
          # 自定義監(jiān)控路徑 monitor
          # 默認值: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)用的運行狀態(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/heapdump

    6、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)用,默認只支持POST請求。

    路徑:http://localhost:8016/monitor/shutdown

    關(guān)于“SpringBoot怎么配置Actuator組件實現(xiàn)系統(tǒng)監(jiān)控”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識,可以關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,小編每天都會為大家更新不同的知識點。

    標題名稱:SpringBoot怎么配置Actuator組件實現(xiàn)系統(tǒng)監(jiān)控
    路徑分享:http://www.rwnh.cn/article12/jieddc.html

    成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站營銷、、小程序開發(fā)網(wǎng)站策劃、電子商務(wù)、網(wǎng)站設(shè)計

    廣告

    聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

    微信小程序開發(fā)
    沂源县| 吴忠市| 元江| 永丰县| 惠来县| 安宁市| 夏津县| 宣威市| 永康市| 宜丰县| 安平县| 隆安县| 通化县| 密山市| 荣昌县| 五河县| 博白县| 昆山市| 英吉沙县| 万州区| 兴和县| 新民市| 天峨县| 麻城市| 丹东市| 古田县| 涟源市| 土默特左旗| 台东市| 都江堰市| 南阳市| 苍南县| 泉州市| 台安县| 姚安县| 开远市| 西昌市| 花莲市| 托里县| 安陆市| 文水县|