国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Spring Boot2.xx開啟監(jiān)控 Actuator

這篇具有很好參考價(jià)值的文章主要介紹了Spring Boot2.xx開啟監(jiān)控 Actuator。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

? ? ? ? ? ? ? ? ? ? ? ?Spring Boot2.xx開啟監(jiān)控 Actuator,spring boot,后端,java

docker實(shí)戰(zhàn)(一):centos7 yum安裝docker

docker實(shí)戰(zhàn)(二):基礎(chǔ)命令篇

docker實(shí)戰(zhàn)(三):docker網(wǎng)絡(luò)模式(超詳細(xì))

docker實(shí)戰(zhàn)(四):docker架構(gòu)原理

docker實(shí)戰(zhàn)(五):docker鏡像及倉庫配置

docker實(shí)戰(zhàn)(六):docker 網(wǎng)絡(luò)及數(shù)據(jù)卷設(shè)置

docker實(shí)戰(zhàn)(七):docker 性質(zhì)及版本選擇

認(rèn)知升維: 道、法、術(shù)、器、勢

?


spring boot actuator介紹

  • Spring Boot包含許多其他功能,可幫助您在將應(yīng)用程序推送到生產(chǎn)環(huán)境時(shí)監(jiān)視和管理應(yīng)用程序。

  • 您可以選擇使用HTTP端點(diǎn)或JMX來管理和監(jiān)視應(yīng)用程序。

  • 審核,運(yùn)行狀況和指標(biāo)收集也可以自動(dòng)應(yīng)用于您的應(yīng)用程序。


    總之Spring Boot Actuator就是一款可以幫助你監(jiān)控系統(tǒng)數(shù)據(jù)的框架,其可以監(jiān)控很多很多的系統(tǒng)數(shù)據(jù),它有對(duì)應(yīng)用系統(tǒng)的自省和監(jiān)控的集成功能,可以查看應(yīng)用配置的詳細(xì)信息,如:
    顯示應(yīng)用程序員的Health健康信息

    顯示Info應(yīng)用信息

    顯示HTTP Request跟蹤信息

    顯示當(dāng)前應(yīng)用程序的“Metrics”信息

    顯示所有的@RequestMapping的路徑信息

    顯示應(yīng)用程序的各種配置信息

    顯示你的程序請(qǐng)求的次數(shù) 時(shí)間 等各種信息


引入Actuactor三角坐標(biāo)依賴?

<!-- 端點(diǎn)監(jiān)控的配置-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.hateoas</groupId>
    <artifactId>spring-hateoas</artifactId>
</dependency>

訪問:?http://localhost:9999/actuator/? ? ? ? ?響應(yīng)信息如下所示

{
?? ?"_links": {
?? ??? ?"self": {
?? ??? ??? ?"href": "http://localhost:9999/actuator",
?? ??? ??? ?"templated": false
?? ??? ?},
?? ??? ?"beans": {
?? ??? ??? ?"href": "http://localhost:9999/actuator/beans",
?? ??? ??? ?"templated": false
?? ??? ?},
?? ??? ?"caches-cache": {
?? ??? ??? ?"href": "http://localhost:9999/actuator/caches/{cache}",
?? ??? ??? ?"templated": true
?? ??? ?},
?? ??? ?"caches": {
?? ??? ??? ?"href": "http://localhost:9999/actuator/caches",
?? ??? ??? ?"templated": false
?? ??? ?},
?? ??? ?"health": {
?? ??? ??? ?"href": "http://localhost:9999/actuator/health",
?? ??? ??? ?"templated": false
?? ??? ?},
?? ??? ?"health-path": {
?? ??? ??? ?"href": "http://localhost:9999/actuator/health/{*path}",
?? ??? ??? ?"templated": true
?? ??? ?},
?? ??? ?"info": {
?? ??? ??? ?"href": "http://localhost:9999/actuator/info",
?? ??? ??? ?"templated": false
?? ??? ?},
?? ??? ?"conditions": {
?? ??? ??? ?"href": "http://localhost:9999/actuator/conditions",
?? ??? ??? ?"templated": false
?? ??? ?},
?? ??? ?"configprops": {
?? ??? ??? ?"href": "http://localhost:9999/actuator/configprops",
?? ??? ??? ?"templated": false
?? ??? ?},
?? ??? ?"configprops-prefix": {
?? ??? ??? ?"href": "http://localhost:9999/actuator/configprops/{prefix}",
?? ??? ??? ?"templated": true
?? ??? ?},
?? ??? ?"env": {
?? ??? ??? ?"href": "http://localhost:9999/actuator/env",
?? ??? ??? ?"templated": false
?? ??? ?},
?? ??? ?"env-toMatch": {
?? ??? ??? ?"href": "http://localhost:9999/actuator/env/{toMatch}",
?? ??? ??? ?"templated": true
?? ??? ?},
?? ??? ?"loggers": {
?? ??? ??? ?"href": "http://localhost:9999/actuator/loggers",
?? ??? ??? ?"templated": false
?? ??? ?},
?? ??? ?"loggers-name": {
?? ??? ??? ?"href": "http://localhost:9999/actuator/loggers/{name}",
?? ??? ??? ?"templated": true
?? ??? ?},
?? ??? ?"heapdump": {
?? ??? ??? ?"href": "http://localhost:9999/actuator/heapdump",
?? ??? ??? ?"templated": false
?? ??? ?},
?? ??? ?"threaddump": {
?? ??? ??? ?"href": "http://localhost:9999/actuator/threaddump",
?? ??? ??? ?"templated": false
?? ??? ?},
?? ??? ?"metrics-requiredMetricName": {
?? ??? ??? ?"href": "http://localhost:9999/actuator/metrics/{requiredMetricName}",
?? ??? ??? ?"templated": true
?? ??? ?},
?? ??? ?"metrics": {
?? ??? ??? ?"href": "http://localhost:9999/actuator/metrics",
?? ??? ??? ?"templated": false
?? ??? ?},
?? ??? ?"scheduledtasks": {
?? ??? ??? ?"href": "http://localhost:9999/actuator/scheduledtasks",
?? ??? ??? ?"templated": false
?? ??? ?},
?? ??? ?"mappings": {
?? ??? ??? ?"href": "http://localhost:9999/actuator/mappings",
?? ??? ??? ?"templated": false
?? ??? ?}
?? ?}
}?


訪問health端點(diǎn):?http://localhost:9999/actuator/health? 響應(yīng)信息如下:

{
?? ?"status": "UP",
?? ?"components": {
?? ??? ?"diskSpace": {
?? ??? ??? ?"status": "UP",
?? ??? ??? ?"details": {
?? ??? ??? ??? ?"total": 1333606182912,
?? ??? ??? ??? ?"free": 1269725843456,
?? ??? ??? ??? ?"threshold": 10485760,
?? ??? ??? ??? ?"exists": true
?? ??? ??? ?}
?? ??? ?},
?? ??? ?"elasticsearch": {
?? ??? ??? ?"status": "UP",
?? ??? ??? ?"details": {
?? ??? ??? ??? ?"cluster_name": "elasticsearch",
?? ??? ??? ??? ?"status": "green",
?? ??? ??? ??? ?"timed_out": false,
?? ??? ??? ??? ?"number_of_nodes": 1,
?? ??? ??? ??? ?"number_of_data_nodes": 1,
?? ??? ??? ??? ?"active_primary_shards": 0,
?? ??? ??? ??? ?"active_shards": 0,
?? ??? ??? ??? ?"relocating_shards": 0,
?? ??? ??? ??? ?"initializing_shards": 0,
?? ??? ??? ??? ?"unassigned_shards": 0,
?? ??? ??? ??? ?"delayed_unassigned_shards": 0,
?? ??? ??? ??? ?"number_of_pending_tasks": 0,
?? ??? ??? ??? ?"number_of_in_flight_fetch": 0,
?? ??? ??? ??? ?"task_max_waiting_in_queue_millis": 0,
?? ??? ??? ??? ?"active_shards_percent_as_number": 100.0
?? ??? ??? ?}
?? ??? ?},
?? ??? ?"ping": {
?? ??? ??? ?"status": "UP"
?? ??? ?},
?? ??? ?"r2dbc": {
?? ??? ??? ?"status": "UP",
?? ??? ??? ?"details": {
?? ??? ??? ??? ?"database": "Jasync-MySQL",
?? ??? ??? ??? ?"validationQuery": "validate(REMOTE)"
?? ??? ??? ?}
?? ??? ?}
?? ?}
}

開啟 Info端點(diǎn):? yml文件中配置:?

# 顯示任意的應(yīng)用信息,默認(rèn)關(guān)閉 springBoot版本:2.7.5 CURRENT GA如果是更低一些的版本默認(rèn)是開啟的

# 在spring boot 2.0以后,actuator默認(rèn)只開啟了info和health兩個(gè)端點(diǎn),要想使用其他的端點(diǎn),需要在application.yml中打開
management:
  endpoint:
    health:
      show-details: always  # 配置health端點(diǎn)顯示詳細(xì)信息
  info:
    env:
      enabled: true  # 顯示任意的應(yīng)用信息,默認(rèn)關(guān)閉  springBoot版本:2.7.5 CURRENT  GA如果是更低一些的版本默認(rèn)是開啟的
  endpoints:
    web:
      exposure:
        include: "*"
      cors:
        allowed-headers: "*"

info:
  app:
    encoding: @project.build.sourceEncoding@
    java:
      source: @java.version@
      target: @java.version@

訪問info端點(diǎn):?http://localhost:9999/actuator/info? ?響應(yīng)信息如下:

{
?? ?"app": {
?? ??? ?"encoding": "UTF-8",
?? ??? ?"java": {
?? ??? ??? ?"source": "1.8.0_221",
?? ??? ??? ?"target": "1.8.0_221"
?? ??? ?}
?? ?}
}


拓展info端點(diǎn):

package org.jd.websocket.auth.data.reactor.help;

import org.springframework.boot.actuate.info.Info;
import org.springframework.boot.actuate.info.InfoContributor;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Component
public class CustomBuildInfoContributor implements InfoContributor {
    @Override
    public void contribute(Info.Builder builder) {
        Map<String,Object> details= new ConcurrentHashMap<>();
        details.put("build",Collections.singletonMap("timestamp",new Date()));
        details.put("author","YangGe");
        builder.withDetails(details);
    }
}

再次訪問info端點(diǎn):?http://localhost:9999/actuator/info? ?響應(yīng)信息如下:?


{
?? ?"app": {
?? ??? ?"encoding": "UTF-8",
?? ??? ?"java": {
?? ??? ??? ?"source": "1.8.0_221",
?? ??? ??? ?"target": "1.8.0_221"
?? ??? ?}
?? ?},
?? ?"build": {
?? ??? ?"timestamp": "2023-08-07T15:14:28.463+00:00"
?? ?},
?? ?"author": "YangGe"
}











management:
? endpoints:
? ? web:
? ? ? base-path: /actuator ?#配置端點(diǎn)訪問前綴
? ? ? exposure:
? ? ? ? include: info,health ?#只暴露info,health兩個(gè)端點(diǎn); “*” 表示暴露所有端點(diǎn)
? ? ? ? exclude: health ?#可以將以暴露的端點(diǎn)排除(不暴露)
?


其他更細(xì)節(jié)的配置可以看官網(wǎng)

spring boot?熱部署導(dǎo)入devtool依賴idea窗口鈍化

yml yet anothor markup language

actuator是spring boot 提供的對(duì)應(yīng)系統(tǒng)的自省和監(jiān)控的基礎(chǔ)功能,當(dāng)出現(xiàn)問題時(shí)可以及時(shí)的定位問題。


拓展Metrics端點(diǎn):

http://localhost:9999/actuator/metrics? ?訪問該端點(diǎn),響應(yīng)信息如下

{
????"names":[
????????"application.ready.time",
????????"application.started.time",
????????"disk.free",
????????"disk.total",
????????"executor.active",
????????"executor.completed",
????????"executor.pool.core",
????????"executor.pool.max",
????????"executor.pool.size",
????????"executor.queue.remaining",
????????"executor.queued",
????????"http.server.requests",
????????"jvm.buffer.count",
????????"jvm.buffer.memory.used",
????????"jvm.buffer.total.capacity",
????????"jvm.classes.loaded",
????????"jvm.classes.unloaded",
????????"jvm.gc.live.data.size",
????????"jvm.gc.max.data.size",
????????"jvm.gc.memory.allocated",
????????"jvm.gc.memory.promoted",
????????"jvm.gc.overhead",
????????"jvm.gc.pause",
????????"jvm.memory.committed",
????????"jvm.memory.max",
????????"jvm.memory.usage.after.gc",
????????"jvm.memory.used",
????????"jvm.threads.daemon",
????????"jvm.threads.live",
????????"jvm.threads.peak",
????????"jvm.threads.states",
????????"logback.events",
????????"process.cpu.usage",
????????"process.start.time",
????????"process.uptime",
????????"system.cpu.count",
????????"system.cpu.usage"
????]
}

對(duì)應(yīng)這些端點(diǎn)信息,用于實(shí)現(xiàn)生產(chǎn)級(jí)的度量工具. 這些指標(biāo)包括內(nèi)存總量,空閑內(nèi)存數(shù)據(jù),處理器數(shù)量,系統(tǒng)正常運(yùn)行時(shí)間,堆信息等,如果想了解某項(xiàng)指標(biāo)的信息,

http://localhost:9999/actuator/metrics

端點(diǎn)后加上上述指標(biāo)的名稱即可。如當(dāng)前內(nèi)存使用情況可以通過:

http://localhost:9999/actuator/metrics/jvm.memory.used? 就會(huì)得到如下響應(yīng)信息:


{
????"name":"jvm.memory.used",
????"description":"The amount of used memory",
????"baseUnit":"bytes",
????"measurements":[
????????{
????????????"statistic":"VALUE",
????????????"value":479145136
????????}
????],
????"availableTags":[
????????{
????????????"tag":"area",
????????????"values":[
????????????????"heap",
????????????????"nonheap"
????????????]
????????},
????????{
????????????"tag":"id",
????????????"values":[
????????????????"Compressed Class Space",
????????????????"PS Survivor Space",
????????????????"PS Old Gen",
????????????????"Metaspace",
????????????????"PS Eden Space",
????????????????"Code Cache"
????????????]
????????}
????]
}


http://localhost:9999/actuator/metrics/jvm.memory.usage.after.gc? gc回收內(nèi)存的情況


{
????"name":"jvm.memory.usage.after.gc",
????"description":"The percentage of long-lived heap pool used after the last GC event, in the range [0..1]",
????"baseUnit":"percent",
????"measurements":[
????????{
????????????"statistic":"VALUE",
????????????"value":0.0014572154044711605
????????}
????],
????"availableTags":[
????????{
????????????"tag":"area",
????????????"values":[
????????????????"heap"
????????????]
????????},
????????{
????????????"tag":"pool",
????????????"values":[
????????????????"long-lived"
????????????]
????????}
????]
}文章來源地址http://www.zghlxwxcb.cn/news/detail-631885.html

到了這里,關(guān)于Spring Boot2.xx開啟監(jiān)控 Actuator的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • Spring Boot Actuator詳解

    Spring Boot Actuator詳解

    Spring Boot Actuator 模塊提供了生產(chǎn)級(jí)別的功能,比如 健康檢查 , 審計(jì) , 指標(biāo)收集 , HTTP跟蹤 等,幫助我們監(jiān)控和管理Spring Boot應(yīng)用。 這個(gè)模塊是一個(gè)采集應(yīng)用內(nèi)部信息暴露給外部的模塊,上述的功能都可以通過HTTP和JMX訪問。 因?yàn)楸┞秲?nèi)部信息的特性,Actuator也可以和一些外

    2024年02月07日
    瀏覽(27)
  • spring boot actuator 禁用后,/actuator仍可正常訪問

    項(xiàng)目上線后,被測試出actuator沒有關(guān)閉,關(guān)閉后,仍可正常訪問/actuator端點(diǎn),只是類似/actuator/env這樣的無法訪問,現(xiàn)在就想把/actuator端點(diǎn)也給禁用了。 spring boot 2.x關(guān)閉actuator配置,關(guān)閉后,仍可正常訪問/actuator端點(diǎn) 說明spring boot 2.x無法通過配置的方式禁用/actuator端點(diǎn) 大部分

    2024年01月19日
    瀏覽(17)
  • Spring Boot中的Actuator是什么?Spring Boot中的Starter依賴是什么?

    在Spring Boot中,Actuator是一種用于監(jiān)控和管理應(yīng)用程序的工具。它提供了一些額外的端點(diǎn)和功能,使開發(fā)人員能夠更好地了解和控制他們的應(yīng)用程序。 Actuator提供了以下功能: 指標(biāo)收集:Actuator可以收集并顯示有關(guān)應(yīng)用程序的指標(biāo),例如內(nèi)存使用情況、線程數(shù)、請(qǐng)求處理時(shí)間等

    2024年02月09日
    瀏覽(17)
  • Spring Boot Actuator未授權(quán)訪問漏洞

    Spring Boot Actuator 端點(diǎn)的未授權(quán)訪問漏洞是一個(gè)安全性問題,可能會(huì)導(dǎo)致未經(jīng)授權(quán)的用戶訪問敏感的應(yīng)用程序信息。 可是并不用太過擔(dān)心,Spring Boot Actuator 默認(rèn)暴漏的信息有限,一般情況下并不會(huì)暴露敏感數(shù)據(jù)。 注冊中心有些功能集成了actuator,如果同時(shí)使用eureka和actuator,可

    2024年02月13日
    瀏覽(19)
  • 關(guān)于Spring Boot Actuator漏洞補(bǔ)救方案

    關(guān)于Spring Boot Actuator漏洞補(bǔ)救方案

    在瀏覽器中范圍于http://192.168.0.119:81/dev-api/actuator(http://IP:端口/actuator),如下圖 幾個(gè)漏洞屬于配置不當(dāng)引起路由暴露。 1.讀取用戶的認(rèn)證字段獲取敏感信息 可以直接嘗試訪問網(wǎng)站目錄下的/trace 路徑,讀取用戶認(rèn)證字段信息,比如在trace 路徑下,會(huì)有用戶的敏感信息,可能

    2024年02月04日
    瀏覽(27)
  • 如何解決 Spring Boot Actuator 的未授權(quán)訪問漏洞

    如何解決 Spring Boot Actuator 的未授權(quán)訪問漏洞

    Spring Boot Actuator ?的作用是提供了一組管理和監(jiān)控端點(diǎn),允許你查看應(yīng)用程序的運(yùn)行時(shí)信息,例如健康狀態(tài)、應(yīng)用程序信息、性能指標(biāo)等。這些端點(diǎn)對(duì)于開發(fā)、 測試 ?和運(yùn)維團(tuán)隊(duì)來說都非常有用,可以幫助快速診斷問題、監(jiān)控應(yīng)用程序的性能,并采取必要的措施來維護(hù)和管理

    2024年02月07日
    瀏覽(30)
  • 如何在Spring Boot中禁用Actuator端點(diǎn)安全性?

    在Spring Boot中,禁用Actuator端點(diǎn)的安全性可以通過配置來實(shí)現(xiàn)。Actuator端點(diǎn)是Spring Boot應(yīng)用程序的管理和監(jiān)控端點(diǎn),它們默認(rèn)受到Spring Security的保護(hù)。如果希望完全禁用Actuator端點(diǎn)的安全性,我們可以按照以下步驟進(jìn)行操作: 確保我們的pom.xml文件中包含了Spring Boot Starter依賴項(xiàng)。

    2024年02月04日
    瀏覽(47)
  • spring boot actuator 未授權(quán)訪問(env泄露redis密碼)

    spring boot actuator 未授權(quán)訪問(env泄露redis密碼)

    Actuator Actuator是Spring Boot提供的服務(wù)監(jiān)控和管理中間件,默認(rèn)配置會(huì)出現(xiàn)接口未授權(quán)訪問,部分接口會(huì)泄露網(wǎng)站流量信息和內(nèi)存信息等,使用Jolokia庫特性甚至可以遠(yuǎn)程執(zhí)行任意代碼,獲取服務(wù)器權(quán)限。 滲透過程 訪問瀏覽器訪問actuator 訪問env獲取到敏感信息redis服務(wù)器地址以及

    2024年02月11日
    瀏覽(22)
  • java Spring Boot 2 /actuator/health 返回 HTTP 404

    spring-boot-starter-actuator官方文檔 Spring Boot 包含許多附加功能,可幫助您在將應(yīng)用程序投入生產(chǎn)時(shí)監(jiān)控和管理應(yīng)用程序。您可以選擇使用 HTTP 端點(diǎn)或 JMX 來管理和監(jiān)控您的應(yīng)用程序。審核、運(yùn)行狀況和指標(biāo)收集也可以自動(dòng)應(yīng)用于您的應(yīng)用程序。 該spring-boot-actuator模塊提供了 Spri

    2024年01月18日
    瀏覽(49)
  • java Spring Boot2.7寫一個(gè)接口 提供圖片預(yù)覽 前端可以直接用接口地址當(dāng)src為圖片地址使用

    java Spring Boot2.7寫一個(gè)接口 提供圖片預(yù)覽 前端可以直接用接口地址當(dāng)src為圖片地址使用

    我們特別是在做小程序開發(fā)時(shí) 很多圖片會(huì)比較大 而小程序本身就對(duì)自身大小要求非常高 所以 圖片放在服務(wù)器上提供訪問鏈接是一種非常好的選擇 我想很多前端會(huì)誤認(rèn)為 直接將圖片放在服務(wù)器上就可以了 但其實(shí)沒那么簡單 因?yàn)榉?wù)器其實(shí)也可以理解為一個(gè)電腦 你就想 你自

    2024年02月07日
    瀏覽(26)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包