您的位置:首页 > 编程语言 > Java开发

spring-boot-starter-actuator(健康监控)配置和使用

2019-07-29 10:29 686 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。 本文链接:https://blog.csdn.net/cc_joke/article/details/88416116

       actuator是监控系统健康情况的工具,在生产环境中,需要实时或定期监控服务的可用性。Spring Boot的actuator(健康监控)功能提供了很多监控所需的接口,可以对应用系统进行配置查看、相关功能统计等。

pom.xml配置

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

果使用HTTP调用的方式,还需要这个依赖:

[code]<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

application.yml配置(指定监控的HTTP端口(如果不指定,则使用和Server相同的端口);指定去掉某项的检查(比如不监控health.mail):)

   

[code]server:
port: 8080
management:
security:
enabled: false #关掉安全认证
port: 8088 #管理端口调整成8088
context-path: /monitor #actuator的访问路径
endpoints:
shutdown:
enabled: true
health:
mail:
enabled: false

info:
app:
name: spring-boot-actuator
version: 1.0.0

 

 

 

 

     

 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: