SpringBoot服务监控Actuator

  在生产环境中,需要实时或定期监控服务的可用性,springboot的actuator功能提供了很多监控所需的接口。actuator是springboot提供的对应用系统的自省和监控的集成功能,可以对应用系统进行配置查看、健康检查、相关功能统计等。

  依赖

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

  application.properties的配置

#management.server.port=8088
#management.server.servlet.context-path=/hello
management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always
#management.endpoint.metrics.cache.time-to-live.seconds=1
management.endpoint.shutdown.enabled=true

1、 查看所有属性源中的的属性

  http://localhost:8089/HelloWorld/actuator/env

  系统变量

  配置文件的属性

 2、health

 3、info

  application.properties配置info信息

info.app.name=demo
info.app.version=1.0
info.app.author=oy

4、查看映射路径与handler方法的对应

 更多使用方法参考:Spring Boot Actuator:健康检查、审计、统计和监控

---

原文地址:https://www.cnblogs.com/xy-ouyang/p/13997571.html