推荐一个分布式JVM监控工具,非常实用!
今日推荐 推荐一个 Java 接口快速开发框架 干掉Random:这个类已经成为获取随机数的王者 Docker + Intellij IDEA,提升 10 倍生产力! 笑出腹肌的注释,都是被代码耽误的诗人! 同事乱用 Redis 卡爆,我真是醉了... RedisJson 横空出世,性能碾压ES和Mongo!
来源:blog.csdn.net/xk4848123/article/
details/106952309
介绍
该项目为了方便开发者更快监控多个远程主机jvm,如果你的项目是Spring boot那么很方便集成,jar包引入即可,不是Spring boot也不用气馁,你可以快速自行初始化一个Spirng boot程序引入jar包即可
效果展示
![](https://filescdn.proginn.com/850788e02c6afc0a60eb8ce06217ae26/e1dbd2ee6e343364a274c627f9212668.webp)
整体架构
![](https://filescdn.proginn.com/dcf8e0566f6a5201e2481aa9faa5f138/2a0e64b76099c7237a853d12511a3ecc.webp)
git地址
https://github.com/xk4848123/monitor https://github.com/xk4848123/monitor-server
使用前提
需要机器中有JDK,不仅仅是JRE,配置好java path,程序中依靠ExcuteCmd找寻jdk基本命令
手把手教你用
克隆monitor-server
git clone https://github.com/xk4848123/monitor-server.git
![](https://filescdn.proginn.com/032a2a1b6266389733e820a66ce76df5/9bde7f7d312e6faed15a0d80c18fdbd2.webp)
idea -> Project from Existing Sources…
![](https://filescdn.proginn.com/f5d37b2c40905051a397d349bbeea178/21a6927d607cf208f461aed6e98dce8c.webp)
选中项目pom.xml
![](https://filescdn.proginn.com/abb61952563860e0760aaaebcd89922d/b62386913d93fcaeb5a0f296bcaaf85b.webp)
修改resources/application.properties
![](https://filescdn.proginn.com/b4bcc08b6342f6e8345f678fc045d5be/187b4197d6cb2f8ec794d62b30762100.webp)
monitor.serve[0].name=serve-1
monitor.serve[0].address=http://127.0.0.1:8081/monitor(这里需要与客户端的monitor.path对应)
monitor.serve[1].name=serve-2
monitor.serve[1].address=http://127.0.0.1:8082(同上)
....
这里可以配置多个监控主机,格式注意下
address=http://ip:port/xxx
(xxx是你在monitor上配置的,下文中会有)name=server-1
(每个monitor不同即可,便于显示时区分)
run monitor-server
![](https://filescdn.proginn.com/fe8b5db0ff3883e92fe0d152cd8bddb5/c15a5744b3ebbf77b8d76fef0904ff94.webp)
有异常没关系,我们把监控客户端也部起来就好了
说在前面
一个操作系统内部署一个监控客户端就好,当你有个多个jvm程序时,只要有一个部署就可以监控
下载Release
https://github.com/xk4848123/monitor
![](https://filescdn.proginn.com/8693f5429bd622339be9b9732e3ff06d/ac5056414c93fe230b650ff0adebc53c.webp)
进入Release列表,下载jar
![](https://filescdn.proginn.com/96076de3758bc1ede89d67964c23281e/a230b507a7e983a3728bcf82951aa124.webp)
本地mvn install(等到博主把jar传到中心仓库就不用这么么麻烦了)
cmd执行以下命令
mvn install:install-file -DgroupId=com.github.xk4848123 -DartifactId=monitor-spring-boot-starter -Dversion=2.3.1 -Dpackaging=jar -Dfile=C:\Users\Administrator\Downloads\monitor-spring-boot-starter.jar
![](https://filescdn.proginn.com/1216a26cecef25500c08609871c325e0/934ea4b04b954e20b7fc3180ae9963d1.webp)
在任意一个Spring boot项目中使用,我这里打开我本地一个叫chat的项目
![](https://filescdn.proginn.com/f298e9e4ae4bd546a80f2133ed519024/11a9794e2a023e20015c2de3402c9a95.webp)
在resources/application.properties增加属性
#决定访问路径,可以自行定义
monitor.path=monitor
#决定是否启动监控客户端
monitor.enable=true
![](https://filescdn.proginn.com/5a7e6af233a31df4f83f57ebf88ee482/c7146cf4d5258d858aa02d66389972f2.webp)
pom.xml引入
![](https://filescdn.proginn.com/43200ff44d94a401c62e8de1d20e13ad/a81bb85918d444c06be66d16be8e36f3.webp)
跑起项目
![](https://filescdn.proginn.com/9585196f14d69ec8ee2732847594f433/f0f4c3a0e6597302c2e93988beae5e82.webp)
OK!
我们现在访问monitor-server(我当下部署的在http://127.0.0.1:8888
,大家根据自己的配置访问)
![](https://filescdn.proginn.com/a0501486df0cd7b860449bf1c70113fb/2fbf39765c8214f569f3315a8766864f.webp)
推荐文章
1、一款高颜值的 SpringBoot+JPA 博客项目 2、超优 Vue+Element+Spring 中后端解决方案 3、推荐几个支付项目! 4、推荐一个 Java 企业信息化系统 5、一款基于 Spring Boot 的现代化社区(论坛/问答/社交网络/博客)
评论