1,简介
Actuator’æ ktʃʊˌeɪtə是 Spring Boot 提供的对应用系统的自省和监控的
集成功能,可以对应用系统进行配置查看、相关功能统计等。在 Spring Cloud 中主要是完成
微服务的监控,完成监控治理。可以查看微服务间的数据处理和调用,当它们之间出现了异
常,就可以快速定位到出现问题的地方。
其功能与 Dubbo 的监控中心类似,不同的是, Dubbo 的监控中心是需要专门部署的,
而 Spring Boot 的 Actuator 是存在于每一个工程中的。
2,使用
1)引入依赖
#Actuator监控的端口号与上下文路径,指定的监控终端的基本访问路径默认为/actuator
management:
server:
port: 9999
servlet:
context-path: /xxx
endpoints:
web:
base-path: /base
exposure:
include: "*"
#自定义info信息
info:
name: zhangchaoyue
url: /fasdf/fdsaf
address: beijing
#读取pom文件
projectId: @project.groupId@
artifactId: @project.artifactId@
开启所有的监控终端
endpoints:
web:
exposure:
include: “*”
关闭指定的终端
endpoints:
web:
exposure:
include: ‘*’
exclude: [‘env’,‘beans’]
常用的监控终端,可搜索百度