boot-actuator 项目安装与使用教程
boot-actuator 项目地址: https://gitcode.com/gh_mirrors/boo/boot-actuator
1. 项目的目录结构及介绍
boot-actuator/
├── actuator-service/
│ ├── src/
│ └── pom.xml
├── boot-monitor/
│ ├── src/
│ └── pom.xml
├── LICENSE
├── README.md
└── actuator.sql
目录结构说明
- actuator-service: 监控端点jar包,需要引入到需要监控的项目中。
- boot-monitor: 监控图形化工程,用于展示监控数据。
- LICENSE: 项目许可证文件。
- README.md: 项目介绍和使用说明。
- actuator.sql: 项目所需的数据库脚本。
2. 项目的启动文件介绍
actuator-service
在需要监控的项目中引入 actuator-service
jar 包,并在启动类上增加扫描包注解:
@ComponentScan("com.pflm.**, com.github.qinxuewu.core")
启动日志出现如下端点信息,则表示集成监控jar包成功:
http://localhost:8080/actuator
boot-monitor
编译成jar或war包启动工程:
nohup java -jar boot-monitor.jar &
访问监控图形化界面:
http://localhost:8080/login
默认账号:admin/admin
3. 项目的配置文件介绍
actuator-service 配置
在需要监控的项目中引入 actuator-service
jar 包,并在 application.properties
中添加以下配置:
# 监控应用名称,唯一
spring.application.name=web1
# 限制白名单访问监控端点,为空则不限制,建议设置
actuator.server.ip=
# 监控远程应用日志
actuator.log.path=F:/log/boot-monitor/spring.log
boot-monitor 配置
在 boot-monitor
项目的 application.properties
中添加以下配置:
# 数据库配置
spring.datasource.url=jdbc:mysql://localhost:3306/boot_monitor
spring.datasource.username=root
spring.datasource.password=root
# 监控端点配置
management.endpoints.web.exposure.include=*
通过以上配置,可以实现对多个web应用的远程监控,并展示监控数据在图形化界面中。
boot-actuator 项目地址: https://gitcode.com/gh_mirrors/boo/boot-actuator
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考