SpringBoot 2.x應用監控配置

                                       Springboot 2.x應用監控

   作用:  用於管理,監控應用,暴露自身信息。減少應用系統在採集應用指標的開發量。

  1.添加依賴:

 <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
 </dependency>

   2: springboot2.0配置:

  在application.properties文件下配置

#actuator端口
management.server.port: 9001
#修改訪問路徑  2.0之前默認是/   2.0默認是 /actuator  可以通過這個屬性值修改
management.endpoints.web.base-path: /actuator
#開放所有頁面節點  默認只開啓了health、info兩個節點
management.endpoints.web.exposure.include:*
#顯示健康具體信息  默認不會顯示詳細信息
management.endpoint.health.show-details: always
 

配置端點的啓用:   management.endpoint.<id>.enabled=true or  false

官方文檔地址:https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html

原來的1.x版本  已經棄用  

management.port=9001
management.security.enabled=false

實例:

 

瀏覽器地址欄訪問: localhost:9001/actuator     

部分截圖:

shutdown 爲post請求  需要用postman插件

management.endpoint.shutdown.enabled = true

 

 

 

 

 

 

 

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章