# SpringBootActuator
Actuator健康监控
# 1. 配置变更
SpringBoot 1.x
management.endpoints.web.base-path = /
management.port = 12143
SpringBoot 2.x
# 默认的访问路径从 / 变成了 /actuator
management.endpoints.web.base-path = /actuator
# 端口配置从 management.port 变更 management.server.port
management.server.port = 12143
- SpringBoot 2.x 可以继续配置为 / 访问,默认是 /actuator
- Actuator 端口不配置为默认的 server.port 应用端口,配置为 -1 为禁用 HTTP 端点
# 2. 配置记录
# management.server.port = 12143
management.endpoints.health.show-details = always
# 开启所有端点,默认只暴露了health、info两个端点
management.endpoints.web.exposure.include = *
# 排除的端点
management.endpoints.web.exposure.exclude = env,beans
# 启动重启端点
management.endpoint.restart.enabled = true
# 启动停止端点
management.endpoint.shutdown.enabled = true
management:
endpoints:
web:
exposure:
include: "*"
exclude: "env,beans"
endpoint:
restart:
enabled: true
shutdown:
enabled: true
启用 restart 和 shutdown,Post请求 /actuator/restart 和 /actuator/shutdown 就可以重启和关闭应用
# 3. 监控集成
Actuator + Prometheus + Grafana
参考