You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.8 KiB
1.8 KiB
1. 搭建 SpringBoot Admin 监控服务器
- 认识 SpringBoot Actuator
- Actuator Endpoints(端点)
- Endpoints 是 Actuator 的核心部分, 它用来监视应用程序及交互, SpringBoot Actuator 内置了很多 Endpoints, 并支持扩展
- SpringBoot Actuator 提供的原生端点有三类:
- 应用配置类:自动配置信息、Spring Bean 信息、yml 文件信息、环境信息等等
- 度量指标类:主要是运行期间的动态信息,例如堆、健康指标、metrics 信息等等
- 操作控制类:主要是指 shutdown,用户可以发送一个请求将应用的监控功能关闭
- Actuator Endpoints(端点)
- 搭建 SpringBoot Admin 监控服务器
- 搭建监控服务器的步骤
- 添加 SpringBoot Admin Starter 自动配置依赖
- spring-boot-admin-starter-server
- 添加启动注解:@EnableAdminServer
- 添加 SpringBoot Admin Starter 自动配置依赖
- 搭建监控服务器的步骤
- SpringBoot Admin 的访问地址: 127.0.0.1:7001/dev-protocol-springcloud-admin
- 其他要被监控的服务加入
spring:
# ...
cloud:
nacos:
discovery:
enabled: true
server-addr: 127.0.0.1:8848
namespace: 1bc13fd5-843b-4ac0-aa55-695c25bc0ac6
metadata:
management:
context-path: ${server.servlet.context-path}/actuator
# 暴露端点
management:
endpoints:
web:
exposure:
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 *, 可以开放所有端点
endpoint:
health:
show-details:
2. 监控中心服务器添加安全访问控制
- 要记住要户名和密码, 防止之后忘记用户名和密码
3. SpringBoot Admin 应用监控总结
- 自定义告警
- 需要有邮箱服务器, 来进行使用邮件告警
- 其他的定制可以自己通过 AbstractEventNotifier 进行定制