SpringBoot-運維監控工具(actuator)

 通過瀏覽器 http://localhost:18080/actuator/health 可以獲得應用的健康信息

        <!--運維監控start-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

 向application.yml添加下面的這行配置,可以顯示更多信息

#運維監控 spring boot2.x中,默認只開放了info、health兩個端點,其餘的需要自己通過配置
management:
  endpoints:
    web:
      exposure:
        #加載所有的端點,默認只加載了info、health
        include: '*'
  endpoint:
    health:
      show-details: always
      #可以關閉指定的端點
    shutdown:
      enabled: true

如果增加下面的這行配置,可以指定上面URL中的端口號和上下文地址,監控頁面的地址將變成http://localhost:8085/admin/health

#運維監控 spring boot2.x中,默認只開放了info、health兩個端點,其餘的需要自己通過配置
management:
  endpoints:
    web:
      exposure:
        #加載所有的端點,默認只加載了info、health
        include: '*'
      base-path: /admin
  endpoint:
    health:
      show-details: always
      #可以關閉指定的端點
    shutdown:
      enabled: true
  server:
    port: 8085

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