├── .gitattributes ├── .gitignore ├── JavaMonitor ├── README.md ├── picture │ ├── 1000.png │ ├── 1001.png │ ├── 1002.png │ ├── 1003.png │ ├── 1004.png │ ├── 20190317192605.png │ └── logo.png ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── github │ │ │ └── onblog │ │ │ └── java_monitor │ │ │ ├── JavaMonitorApplication.java │ │ │ ├── core │ │ │ ├── cmd │ │ │ │ ├── ExecuteCmd.java │ │ │ │ └── InputStreamRunnable.java │ │ │ ├── entity │ │ │ │ ├── JinfoEntity.java │ │ │ │ ├── JpsEntity.java │ │ │ │ ├── JstackEntity.java │ │ │ │ └── KVEntity.java │ │ │ ├── order │ │ │ │ ├── Javav.java │ │ │ │ ├── Jinfo.java │ │ │ │ ├── Jmap.java │ │ │ │ ├── Jps.java │ │ │ │ ├── Jstack.java │ │ │ │ └── Jstat.java │ │ │ ├── parm │ │ │ │ └── JavaHome.java │ │ │ └── util │ │ │ │ ├── ArrayUtil.java │ │ │ │ └── PathUtil.java │ │ │ ├── dump │ │ │ └── DumpController.java │ │ │ ├── h2 │ │ │ ├── dao │ │ │ │ ├── ClassLoadRespository.java │ │ │ │ ├── GcRespository.java │ │ │ │ └── ThreadRespository.java │ │ │ ├── entity │ │ │ │ ├── ClassLoadEntity.java │ │ │ │ ├── GcEntity.java │ │ │ │ └── ThreadEntity.java │ │ │ └── service │ │ │ │ ├── ClassService.java │ │ │ │ ├── GcService.java │ │ │ │ └── ThreadService.java │ │ │ ├── html │ │ │ └── Controllers.java │ │ │ ├── socket │ │ │ ├── config │ │ │ │ └── WebSocketConfig.java │ │ │ └── controller │ │ │ │ └── GreetingController.java │ │ │ └── timer │ │ │ ├── config │ │ │ └── QuartzConfig.java │ │ │ ├── job │ │ │ ├── ClearDumpJob.java │ │ │ ├── ClearJob.java │ │ │ └── UpdataJob.java │ │ │ ├── parm │ │ │ └── CronParm.java │ │ │ └── util │ │ │ └── TimerUtil.java │ └── resources │ │ ├── application.properties │ │ ├── static │ │ ├── ico │ │ │ └── favicon.ico │ │ ├── js │ │ │ ├── ccsc.js │ │ │ ├── classn.js │ │ │ ├── classt.js │ │ │ ├── combyte.js │ │ │ ├── comn.js │ │ │ ├── comt.js │ │ │ ├── eden.js │ │ │ ├── gcn.js │ │ │ ├── gct.js │ │ │ ├── mc.js │ │ │ ├── old.js │ │ │ ├── s0.js │ │ │ ├── s1.js │ │ │ ├── socket.js │ │ │ ├── thread.js │ │ │ └── util.js │ │ └── lib │ │ │ ├── bootstrap.min.css │ │ │ ├── echarts-all.js │ │ │ ├── echarts.min.js │ │ │ ├── jquery.min.js │ │ │ ├── layui │ │ │ ├── css │ │ │ │ ├── layui.css │ │ │ │ ├── layui.mobile.css │ │ │ │ └── modules │ │ │ │ │ ├── code.css │ │ │ │ │ ├── laydate │ │ │ │ │ └── default │ │ │ │ │ │ └── laydate.css │ │ │ │ │ └── layer │ │ │ │ │ └── default │ │ │ │ │ ├── icon-ext.png │ │ │ │ │ ├── icon.png │ │ │ │ │ ├── layer.css │ │ │ │ │ ├── loading-0.gif │ │ │ │ │ ├── loading-1.gif │ │ │ │ │ └── loading-2.gif │ │ │ ├── font │ │ │ │ ├── iconfont.eot │ │ │ │ ├── iconfont.svg │ │ │ │ ├── iconfont.ttf │ │ │ │ └── iconfont.woff │ │ │ ├── images │ │ │ │ └── face │ │ │ │ │ ├── 0.gif │ │ │ │ │ ├── 1.gif │ │ │ │ │ ├── 10.gif │ │ │ │ │ ├── 11.gif │ │ │ │ │ ├── 12.gif │ │ │ │ │ ├── 13.gif │ │ │ │ │ ├── 14.gif │ │ │ │ │ ├── 15.gif │ │ │ │ │ ├── 16.gif │ │ │ │ │ ├── 17.gif │ │ │ │ │ ├── 18.gif │ │ │ │ │ ├── 19.gif │ │ │ │ │ ├── 2.gif │ │ │ │ │ ├── 20.gif │ │ │ │ │ ├── 21.gif │ │ │ │ │ ├── 22.gif │ │ │ │ │ ├── 23.gif │ │ │ │ │ ├── 24.gif │ │ │ │ │ ├── 25.gif │ │ │ │ │ ├── 26.gif │ │ │ │ │ ├── 27.gif │ │ │ │ │ ├── 28.gif │ │ │ │ │ ├── 29.gif │ │ │ │ │ ├── 3.gif │ │ │ │ │ ├── 30.gif │ │ │ │ │ ├── 31.gif │ │ │ │ │ ├── 32.gif │ │ │ │ │ ├── 33.gif │ │ │ │ │ ├── 34.gif │ │ │ │ │ ├── 35.gif │ │ │ │ │ ├── 36.gif │ │ │ │ │ ├── 37.gif │ │ │ │ │ ├── 38.gif │ │ │ │ │ ├── 39.gif │ │ │ │ │ ├── 4.gif │ │ │ │ │ ├── 40.gif │ │ │ │ │ ├── 41.gif │ │ │ │ │ ├── 42.gif │ │ │ │ │ ├── 43.gif │ │ │ │ │ ├── 44.gif │ │ │ │ │ ├── 45.gif │ │ │ │ │ ├── 46.gif │ │ │ │ │ ├── 47.gif │ │ │ │ │ ├── 48.gif │ │ │ │ │ ├── 49.gif │ │ │ │ │ ├── 5.gif │ │ │ │ │ ├── 50.gif │ │ │ │ │ ├── 51.gif │ │ │ │ │ ├── 52.gif │ │ │ │ │ ├── 53.gif │ │ │ │ │ ├── 54.gif │ │ │ │ │ ├── 55.gif │ │ │ │ │ ├── 56.gif │ │ │ │ │ ├── 57.gif │ │ │ │ │ ├── 58.gif │ │ │ │ │ ├── 59.gif │ │ │ │ │ ├── 6.gif │ │ │ │ │ ├── 60.gif │ │ │ │ │ ├── 61.gif │ │ │ │ │ ├── 62.gif │ │ │ │ │ ├── 63.gif │ │ │ │ │ ├── 64.gif │ │ │ │ │ ├── 65.gif │ │ │ │ │ ├── 66.gif │ │ │ │ │ ├── 67.gif │ │ │ │ │ ├── 68.gif │ │ │ │ │ ├── 69.gif │ │ │ │ │ ├── 7.gif │ │ │ │ │ ├── 70.gif │ │ │ │ │ ├── 71.gif │ │ │ │ │ ├── 8.gif │ │ │ │ │ └── 9.gif │ │ │ ├── lay │ │ │ │ └── modules │ │ │ │ │ ├── carousel.js │ │ │ │ │ ├── code.js │ │ │ │ │ ├── colorpicker.js │ │ │ │ │ ├── element.js │ │ │ │ │ ├── flow.js │ │ │ │ │ ├── form.js │ │ │ │ │ ├── jquery.js │ │ │ │ │ ├── laydate.js │ │ │ │ │ ├── layedit.js │ │ │ │ │ ├── layer.js │ │ │ │ │ ├── laypage.js │ │ │ │ │ ├── laytpl.js │ │ │ │ │ ├── mobile.js │ │ │ │ │ ├── rate.js │ │ │ │ │ ├── slider.js │ │ │ │ │ ├── table.js │ │ │ │ │ ├── tree.js │ │ │ │ │ ├── upload.js │ │ │ │ │ └── util.js │ │ │ ├── layui.all.js │ │ │ └── layui.js │ │ │ ├── sockjs.min.js │ │ │ └── stomp.min.js │ │ └── templates │ │ ├── index.html │ │ ├── main.html │ │ └── monitor.html │ └── test │ └── java │ └── com │ └── github │ └── onblog │ └── java_monitor │ ├── JavaMonitorApplicationTests.java │ └── core │ └── order │ ├── AbstractJmxCommand.java │ ├── JpsTest.java │ └── Tools.java ├── JavaMonitorPlus ├── client │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── github │ │ │ │ └── onblog │ │ │ │ └── client │ │ │ │ ├── ClientApplication.java │ │ │ │ ├── core │ │ │ │ ├── cmd │ │ │ │ │ ├── ExecuteCmd.java │ │ │ │ │ └── InputStreamRunnable.java │ │ │ │ ├── entity │ │ │ │ │ ├── JinfoEntity.java │ │ │ │ │ ├── JpsEntity.java │ │ │ │ │ ├── JstackEntity.java │ │ │ │ │ └── KVEntity.java │ │ │ │ ├── order │ │ │ │ │ ├── Javav.java │ │ │ │ │ ├── Jinfo.java │ │ │ │ │ ├── Jmap.java │ │ │ │ │ ├── Jps.java │ │ │ │ │ ├── Jstack.java │ │ │ │ │ └── Jstat.java │ │ │ │ └── util │ │ │ │ │ ├── ArrayUtil.java │ │ │ │ │ └── PathUtil.java │ │ │ │ ├── dump │ │ │ │ ├── DumpController.java │ │ │ │ ├── exception │ │ │ │ │ ├── DumpException.java │ │ │ │ │ └── ExceptionHandle.java │ │ │ │ └── timer │ │ │ │ │ └── ClearDumpJob.java │ │ │ │ ├── order │ │ │ │ └── OrderController.java │ │ │ │ └── system │ │ │ │ └── SystemController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── github │ │ └── onblog │ │ └── client │ │ └── ClientApplicationTests.java └── server │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── github │ │ │ └── onblog │ │ │ └── server │ │ │ ├── ServerApplication.java │ │ │ ├── core │ │ │ ├── entity │ │ │ │ ├── JinfoEntity.java │ │ │ │ ├── JpsEntity.java │ │ │ │ ├── JstackEntity.java │ │ │ │ └── KVEntity.java │ │ │ └── util │ │ │ │ └── PathUtil.java │ │ │ ├── database │ │ │ ├── dao │ │ │ │ ├── ClassLoadRespository.java │ │ │ │ ├── GcRespository.java │ │ │ │ └── ThreadRespository.java │ │ │ ├── entity │ │ │ │ ├── ClassLoadEntity.java │ │ │ │ ├── GcEntity.java │ │ │ │ └── ThreadEntity.java │ │ │ └── service │ │ │ │ ├── ClassService.java │ │ │ │ ├── GcService.java │ │ │ │ └── ThreadService.java │ │ │ ├── remote │ │ │ ├── CallingMethod.java │ │ │ ├── parm │ │ │ │ ├── AddressParm.java │ │ │ │ └── entity │ │ │ │ │ └── Address.java │ │ │ └── util │ │ │ │ └── HttpUtil.java │ │ │ ├── security │ │ │ ├── MySerurityConfig.java │ │ │ ├── encode │ │ │ │ └── MyPasswordEncoder.java │ │ │ └── parm │ │ │ │ └── SerurityParm.java │ │ │ ├── socket │ │ │ ├── config │ │ │ │ └── WebSocketConfig.java │ │ │ └── controller │ │ │ │ └── GreetingController.java │ │ │ ├── timer │ │ │ ├── config │ │ │ │ └── QuartzConfig.java │ │ │ ├── job │ │ │ │ ├── ClearJob.java │ │ │ │ └── UpdataJob.java │ │ │ ├── parm │ │ │ │ └── CronParm.java │ │ │ └── util │ │ │ │ └── TimerUtil.java │ │ │ └── view │ │ │ ├── ViewController.java │ │ │ ├── entity │ │ │ └── Message.java │ │ │ └── service │ │ │ └── ViewService.java │ └── resources │ │ ├── application.properties │ │ ├── ehcache.xml │ │ ├── static │ │ ├── ico │ │ │ └── favicon.ico │ │ ├── js │ │ │ ├── ccsc.js │ │ │ ├── classn.js │ │ │ ├── classt.js │ │ │ ├── combyte.js │ │ │ ├── comn.js │ │ │ ├── comt.js │ │ │ ├── eden.js │ │ │ ├── gcn.js │ │ │ ├── gct.js │ │ │ ├── mc.js │ │ │ ├── old.js │ │ │ ├── s0.js │ │ │ ├── s1.js │ │ │ ├── socket.js │ │ │ ├── thread.js │ │ │ └── util.js │ │ └── lib │ │ │ ├── bootstrap.min.css │ │ │ ├── echarts-all.js │ │ │ ├── echarts.min.js │ │ │ ├── jquery.min.js │ │ │ ├── layui │ │ │ ├── css │ │ │ │ ├── layui.css │ │ │ │ ├── layui.mobile.css │ │ │ │ └── modules │ │ │ │ │ ├── code.css │ │ │ │ │ ├── laydate │ │ │ │ │ └── default │ │ │ │ │ │ └── laydate.css │ │ │ │ │ └── layer │ │ │ │ │ └── default │ │ │ │ │ ├── icon-ext.png │ │ │ │ │ ├── icon.png │ │ │ │ │ ├── layer.css │ │ │ │ │ ├── loading-0.gif │ │ │ │ │ ├── loading-1.gif │ │ │ │ │ └── loading-2.gif │ │ │ ├── font │ │ │ │ ├── iconfont.eot │ │ │ │ ├── iconfont.svg │ │ │ │ ├── iconfont.ttf │ │ │ │ └── iconfont.woff │ │ │ ├── images │ │ │ │ └── face │ │ │ │ │ ├── 0.gif │ │ │ │ │ ├── 1.gif │ │ │ │ │ ├── 10.gif │ │ │ │ │ ├── 11.gif │ │ │ │ │ ├── 12.gif │ │ │ │ │ ├── 13.gif │ │ │ │ │ ├── 14.gif │ │ │ │ │ ├── 15.gif │ │ │ │ │ ├── 16.gif │ │ │ │ │ ├── 17.gif │ │ │ │ │ ├── 18.gif │ │ │ │ │ ├── 19.gif │ │ │ │ │ ├── 2.gif │ │ │ │ │ ├── 20.gif │ │ │ │ │ ├── 21.gif │ │ │ │ │ ├── 22.gif │ │ │ │ │ ├── 23.gif │ │ │ │ │ ├── 24.gif │ │ │ │ │ ├── 25.gif │ │ │ │ │ ├── 26.gif │ │ │ │ │ ├── 27.gif │ │ │ │ │ ├── 28.gif │ │ │ │ │ ├── 29.gif │ │ │ │ │ ├── 3.gif │ │ │ │ │ ├── 30.gif │ │ │ │ │ ├── 31.gif │ │ │ │ │ ├── 32.gif │ │ │ │ │ ├── 33.gif │ │ │ │ │ ├── 34.gif │ │ │ │ │ ├── 35.gif │ │ │ │ │ ├── 36.gif │ │ │ │ │ ├── 37.gif │ │ │ │ │ ├── 38.gif │ │ │ │ │ ├── 39.gif │ │ │ │ │ ├── 4.gif │ │ │ │ │ ├── 40.gif │ │ │ │ │ ├── 41.gif │ │ │ │ │ ├── 42.gif │ │ │ │ │ ├── 43.gif │ │ │ │ │ ├── 44.gif │ │ │ │ │ ├── 45.gif │ │ │ │ │ ├── 46.gif │ │ │ │ │ ├── 47.gif │ │ │ │ │ ├── 48.gif │ │ │ │ │ ├── 49.gif │ │ │ │ │ ├── 5.gif │ │ │ │ │ ├── 50.gif │ │ │ │ │ ├── 51.gif │ │ │ │ │ ├── 52.gif │ │ │ │ │ ├── 53.gif │ │ │ │ │ ├── 54.gif │ │ │ │ │ ├── 55.gif │ │ │ │ │ ├── 56.gif │ │ │ │ │ ├── 57.gif │ │ │ │ │ ├── 58.gif │ │ │ │ │ ├── 59.gif │ │ │ │ │ ├── 6.gif │ │ │ │ │ ├── 60.gif │ │ │ │ │ ├── 61.gif │ │ │ │ │ ├── 62.gif │ │ │ │ │ ├── 63.gif │ │ │ │ │ ├── 64.gif │ │ │ │ │ ├── 65.gif │ │ │ │ │ ├── 66.gif │ │ │ │ │ ├── 67.gif │ │ │ │ │ ├── 68.gif │ │ │ │ │ ├── 69.gif │ │ │ │ │ ├── 7.gif │ │ │ │ │ ├── 70.gif │ │ │ │ │ ├── 71.gif │ │ │ │ │ ├── 8.gif │ │ │ │ │ └── 9.gif │ │ │ ├── lay │ │ │ │ └── modules │ │ │ │ │ ├── carousel.js │ │ │ │ │ ├── code.js │ │ │ │ │ ├── colorpicker.js │ │ │ │ │ ├── element.js │ │ │ │ │ ├── flow.js │ │ │ │ │ ├── form.js │ │ │ │ │ ├── jquery.js │ │ │ │ │ ├── laydate.js │ │ │ │ │ ├── layedit.js │ │ │ │ │ ├── layer.js │ │ │ │ │ ├── laypage.js │ │ │ │ │ ├── laytpl.js │ │ │ │ │ ├── mobile.js │ │ │ │ │ ├── rate.js │ │ │ │ │ ├── slider.js │ │ │ │ │ ├── table.js │ │ │ │ │ ├── tree.js │ │ │ │ │ ├── upload.js │ │ │ │ │ └── util.js │ │ │ ├── layui.all.js │ │ │ └── layui.js │ │ │ ├── sockjs.min.js │ │ │ └── stomp.min.js │ │ └── templates │ │ ├── index.html │ │ ├── main.html │ │ └── monitor.html │ └── test │ └── java │ └── com │ └── github │ └── onblog │ └── server │ ├── ServerApplicationTests.java │ └── remote │ └── CallingMethodTest.java ├── LICENSE └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | *.css linguist-language=java 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Example user template template 3 | ### Example user template 4 | 5 | # IntelliJ project files 6 | .idea 7 | *.iml 8 | out 9 | gen 10 | target -------------------------------------------------------------------------------- /JavaMonitor/picture/1000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/picture/1000.png -------------------------------------------------------------------------------- /JavaMonitor/picture/1001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/picture/1001.png -------------------------------------------------------------------------------- /JavaMonitor/picture/1002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/picture/1002.png -------------------------------------------------------------------------------- /JavaMonitor/picture/1003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/picture/1003.png -------------------------------------------------------------------------------- /JavaMonitor/picture/1004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/picture/1004.png -------------------------------------------------------------------------------- /JavaMonitor/picture/20190317192605.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/picture/20190317192605.png -------------------------------------------------------------------------------- /JavaMonitor/picture/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/picture/logo.png -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/JavaMonitorApplication.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.scheduling.annotation.EnableScheduling; 6 | 7 | @SpringBootApplication 8 | @EnableScheduling 9 | public class JavaMonitorApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(JavaMonitorApplication.class, args); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/core/cmd/ExecuteCmd.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.core.cmd; 2 | 3 | import java.io.BufferedInputStream; 4 | import java.io.BufferedReader; 5 | import java.io.InputStreamReader; 6 | 7 | /** 8 | * Create by Martin 2018/11/9 0009 22:28 9 | */ 10 | public class ExecuteCmd { 11 | /** 12 | * 执行外部程序,并获取标准输出 13 | */ 14 | public static String execute(String[] cmd,String... encoding) { 15 | BufferedReader bufferedReader; 16 | InputStreamReader inputStreamReader; 17 | try { 18 | Process p = Runtime.getRuntime().exec(cmd); 19 | 20 | /* 为"错误输出流"单独开一个线程读取之,否则会造成标准输出流的阻塞 */ 21 | Thread t = new Thread(new InputStreamRunnable(p.getErrorStream(), "ErrorStream")); 22 | t.start(); 23 | 24 | /* "标准输出流"就在当前方法中读取 */ 25 | BufferedInputStream bis = new BufferedInputStream(p.getInputStream()); 26 | 27 | if (encoding != null && encoding.length != 0) { 28 | inputStreamReader = new InputStreamReader(bis, encoding[0]);// 设置编码方式 29 | } else { 30 | inputStreamReader = new InputStreamReader(bis, "utf-8"); 31 | } 32 | bufferedReader = new BufferedReader(inputStreamReader); 33 | 34 | StringBuilder sb = new StringBuilder(); 35 | String line; 36 | 37 | while ((line = bufferedReader.readLine()) != null) { 38 | sb.append(line); 39 | sb.append("\n"); 40 | } 41 | 42 | bufferedReader.close(); 43 | p.destroy(); 44 | return sb.toString(); 45 | } catch (Exception e) { 46 | e.printStackTrace(); 47 | return null; 48 | } 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/core/cmd/InputStreamRunnable.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.core.cmd; 2 | 3 | import java.io.BufferedInputStream; 4 | import java.io.BufferedReader; 5 | import java.io.InputStream; 6 | import java.io.InputStreamReader; 7 | 8 | /** 9 | * Create by Martin 2018/11/9 0009 22:32 10 | */ 11 | class InputStreamRunnable implements Runnable { 12 | private BufferedReader bReader = null; 13 | 14 | InputStreamRunnable(InputStream is, String type) { 15 | try { 16 | bReader = new BufferedReader(new InputStreamReader(new BufferedInputStream(is), "UTF-8")); 17 | } catch (Exception ex) { 18 | ex.printStackTrace(); 19 | } 20 | } 21 | 22 | @Override 23 | public void run() { 24 | String line; 25 | int num = 1; 26 | try { 27 | while ((line = bReader.readLine()) != null) { 28 | System.out.println(String.format("%02d",num++)+" "+line); 29 | } 30 | bReader.close(); 31 | } catch (Exception ex) { 32 | ex.printStackTrace(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/core/entity/JinfoEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.core.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Create by Martin 2018/11/15 0015 14:27 9 | */ 10 | @Data 11 | public class JinfoEntity { 12 | private List noedefault; 13 | private List commandLine; 14 | 15 | public JinfoEntity(List noedefault, List commandLine) { 16 | this.noedefault = noedefault; 17 | this.commandLine = commandLine; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/core/entity/JpsEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.core.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Create by Martin 2018/10/22 21:47 9 | */ 10 | @Data 11 | public class JpsEntity { 12 | private String className; //全名 13 | private String smallName; //小名 14 | private List parameters; //参数 15 | 16 | public JpsEntity(String className, String smallName, List parameters) { 17 | this.className = className; 18 | this.smallName = smallName; 19 | this.parameters = parameters; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/core/entity/JstackEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.core.entity; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * Create by Martin 2018/11/10 0010 17:54 7 | */ 8 | @Data 9 | public class JstackEntity { 10 | private String id; 11 | private int total; 12 | private int RUNNABLE; 13 | private int TIMED_WAITING; 14 | private int WAITING; 15 | 16 | public JstackEntity(String id, int total, int RUNNABLE, int TIMED_WAITING, int WAITING) { 17 | this.id = id; 18 | this.total = total; 19 | this.RUNNABLE = RUNNABLE; 20 | this.TIMED_WAITING = TIMED_WAITING; 21 | this.WAITING = WAITING; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/core/entity/KVEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.core.entity; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * Create by Martin 2018/11/10 0010 14:51 7 | */ 8 | @Data 9 | public class KVEntity { 10 | private String key; 11 | private String value; 12 | 13 | public KVEntity(String key, String value) { 14 | this.key = key; 15 | this.value = value; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/core/order/Javav.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.core.order; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | 7 | /** 8 | * Create by Martin 2018/11/15 0015 0:23 9 | */ 10 | public class Javav { 11 | 12 | public static String version(){ 13 | StringBuilder sb = null; 14 | try { 15 | Process p = Runtime.getRuntime().exec(new String[]{"java", "-version"}); 16 | InputStreamReader inputStreamReader = new InputStreamReader(p.getErrorStream()); 17 | BufferedReader bufferedReader = new BufferedReader(inputStreamReader); 18 | sb = new StringBuilder(); 19 | String line; 20 | while ((line = bufferedReader.readLine()) != null) { 21 | sb.append(line); 22 | sb.append("\n"); 23 | } 24 | bufferedReader.close(); 25 | p.destroy(); 26 | return sb.toString(); 27 | } catch (IOException e) { 28 | e.printStackTrace(); 29 | } 30 | return ""; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/core/order/Jinfo.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.core.order; 2 | 3 | import com.github.onblog.java_monitor.core.cmd.ExecuteCmd; 4 | import com.github.onblog.java_monitor.core.entity.JinfoEntity; 5 | import com.github.onblog.java_monitor.core.util.ArrayUtil; 6 | 7 | import java.util.Arrays; 8 | import java.util.stream.Collectors; 9 | 10 | /** 11 | * Create by Martin 2018/11/15 0015 13:54 12 | */ 13 | public class Jinfo { 14 | 15 | 16 | /** 17 | * JVM默认参数与指定参数 18 | * @param id 19 | * @return 20 | */ 21 | public static JinfoEntity info(String id){ 22 | String s = ExecuteCmd.execute(new String[]{"jinfo","-flags", id}); 23 | if (!s.contains("successfully")){ 24 | return null; 25 | } 26 | String flags = "flags:"; 27 | String command = "Command line:"; 28 | //默认参数 29 | String[] noedefault = ArrayUtil.trim(s.substring(s.indexOf(flags)+flags.length(),s.indexOf(command)).split("\\s+")); 30 | String[] commandLine = null; 31 | s = s.substring(s.indexOf(command)); 32 | if (!s.equals(command)){ 33 | commandLine = s.substring(command.length()).split("\\s+"); 34 | } 35 | commandLine = ArrayUtil.trim(commandLine); 36 | return new JinfoEntity(Arrays.stream(noedefault).collect(Collectors.toList()), Arrays.stream(commandLine).collect(Collectors.toList()) ); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/core/order/Jmap.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.core.order; 2 | 3 | import com.github.onblog.java_monitor.core.cmd.ExecuteCmd; 4 | import com.github.onblog.java_monitor.core.util.PathUtil; 5 | 6 | import java.io.File; 7 | 8 | /** 9 | * Create by Martin 2018/11/14 0014 22:21 10 | */ 11 | public class Jmap { 12 | 13 | /** 14 | * 导出堆快照 15 | * @param id 16 | * @return 17 | */ 18 | public static String dump(String id){ 19 | String path = PathUtil.getRootPath("dump/"+id+"_heap.hprof"); 20 | File file = new File(PathUtil.getRootPath("dump/")); 21 | if (!file.exists()){ 22 | file.mkdirs(); 23 | } 24 | ExecuteCmd.execute(new String[]{"jmap","-dump:format=b,file="+path, id}); 25 | return path; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/core/order/Jps.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.core.order; 2 | 3 | import com.github.onblog.java_monitor.core.cmd.ExecuteCmd; 4 | import com.github.onblog.java_monitor.core.entity.JinfoEntity; 5 | import com.github.onblog.java_monitor.core.entity.JpsEntity; 6 | 7 | import java.util.Arrays; 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | import java.util.stream.Collectors; 11 | 12 | /** 13 | * Create by Martin 2018/10/22 20:22 14 | */ 15 | public class Jps { 16 | 17 | /** 18 | * Jps 命令结果 19 | * key:进程Id 20 | * @return map 21 | */ 22 | public static Map jps() { 23 | Map map = new HashMap<>(); 24 | String s = ExecuteCmd.execute(new String[]{"jps", "-l", "-v"}); 25 | String[] line = s != null ? s.split("\n") : new String[0]; 26 | for (String aLine : line) { 27 | String[] one = aLine.split("\\s+"); 28 | //排除sun.tools进程 29 | if (one[1].contains("sun.tools")){ 30 | continue; 31 | } 32 | //格式化控制台输出 33 | if (!one[1].substring(0, 1).equals("-")) { 34 | String smallName = one[1].contains(".") ? one[1].substring(one[1].lastIndexOf(".")+1) : one[1]; 35 | smallName = smallName.equalsIgnoreCase("jar")? one[1] : smallName; 36 | map.put(one[0], new JpsEntity(one[1], smallName, Arrays.stream(one).skip(2).collect(Collectors.toList()))); 37 | } else { 38 | map.put(one[0], new JpsEntity("NULL","NULL", Arrays.stream(one).skip(1).collect(Collectors.toList()))); 39 | } 40 | //测试jinfo 41 | JinfoEntity info = Jinfo.info(one[0]); 42 | System.out.println(); 43 | System.out.println(info); 44 | } 45 | return map; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/core/order/Jstack.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.core.order; 2 | 3 | import com.github.onblog.java_monitor.core.cmd.ExecuteCmd; 4 | import com.github.onblog.java_monitor.core.entity.JstackEntity; 5 | import com.github.onblog.java_monitor.core.util.ArrayUtil; 6 | import com.github.onblog.java_monitor.core.util.PathUtil; 7 | import org.apache.commons.io.FileUtils; 8 | 9 | import java.io.File; 10 | import java.io.IOException; 11 | import java.nio.charset.Charset; 12 | 13 | /** 14 | * Create by Martin 2018/11/10 0010 17:59 15 | */ 16 | public class Jstack { 17 | private final static String prefix = "java.lang.Thread.State: "; 18 | /** 19 | * 该进程的线程信息 20 | * X轴为时间,Y轴为值的变化 21 | * @param id 22 | * @return 23 | */ 24 | public static JstackEntity jstack(String id) { 25 | String s = ExecuteCmd.execute(new String[]{"jstack", id}); 26 | int total= ArrayUtil.appearNumber(s, "nid="); 27 | int RUNNABLE = ArrayUtil.appearNumber(s, prefix+"RUNNABLE"); 28 | int TIMED_WAITING = ArrayUtil.appearNumber(s,prefix+"TIMED_WAITING"); 29 | int WAITING = ArrayUtil.appearNumber(s,prefix+"WAITING"); 30 | return new JstackEntity(id,total,RUNNABLE,TIMED_WAITING,WAITING); 31 | } 32 | 33 | /** 34 | * 导出线程快照 35 | * @param id 36 | * @return 37 | */ 38 | public static String dump(String id) throws IOException { 39 | String path = PathUtil.getRootPath("dump/"+id+"_thread.txt"); 40 | String s = ExecuteCmd.execute(new String[]{"jstack", id}); 41 | File file = new File(path); 42 | FileUtils.write(file,s,Charset.forName("UTF-8")); 43 | return path; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/core/parm/JavaHome.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.core.parm; 2 | 3 | import org.springframework.web.context.ContextLoader; 4 | import org.springframework.web.context.WebApplicationContext; 5 | 6 | import java.io.File; 7 | 8 | /** 9 | * 已废弃 10 | * #java.home.bin=D:\Java\jdk1.8.0\bin\ 11 | * Create by Martin 2018/12/30 0030 15:27 12 | */ 13 | //@Component 14 | //@ConfigurationProperties(prefix="java.home") 15 | public class JavaHome { 16 | private String bin; 17 | 18 | private final static String path_default = System.getenv("JAVA_HOME")+File.separator +"bin"+File.separator; 19 | 20 | public String getBin() { 21 | // 先判断是否是Null对象,再判断是否是空字符串 22 | if (bin ==null|| bin.trim().isEmpty()){ 23 | return path_default; 24 | } 25 | // 是否以分隔符结尾 26 | if (bin.lastIndexOf(File.separator)!=bin.length()-1){ 27 | bin += File.separator; 28 | } 29 | return bin; 30 | } 31 | 32 | public void setBin(String bin) { 33 | this.bin = bin; 34 | } 35 | 36 | public static String getPath(){ 37 | WebApplicationContext wac = ContextLoader.getCurrentWebApplicationContext(); 38 | JavaHome javaHome = (JavaHome) wac.getBean("javaHome"); 39 | return javaHome.getBin(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/core/util/ArrayUtil.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.core.util; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.regex.Matcher; 6 | import java.util.regex.Pattern; 7 | 8 | /** 9 | * Create by Martin 2018/11/10 0010 15:50 10 | */ 11 | public class ArrayUtil { 12 | 13 | /** 14 | * 去掉数组中空项 15 | * 16 | * @param olds 17 | * @return news 18 | */ 19 | public static String[] trim(String[] olds) { 20 | if (olds ==null ||olds.length == 0){ 21 | return olds; 22 | } 23 | List list = new ArrayList<>(); 24 | for (String old : olds) { 25 | if (old != null && !"".equals(old)) { 26 | list.add(old); 27 | } 28 | } 29 | String[] news = new String[list.size()]; 30 | for (int i = 0; i < list.size(); i++) { 31 | news[i] = list.get(i); 32 | } 33 | return news; 34 | } 35 | 36 | /** 37 | * 匹配字符出现次数 38 | * @param srcText 39 | * @param findText 40 | * @return 41 | */ 42 | public static int appearNumber(String srcText, String findText) { 43 | int count = 0; 44 | Pattern p = Pattern.compile(findText); 45 | Matcher m = p.matcher(srcText); 46 | while (m.find()) { 47 | count++; 48 | } 49 | return count; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/core/util/PathUtil.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.core.util; 2 | 3 | /** 4 | * Create by Martin 2018/11/14 0014 22:34 5 | */ 6 | 7 | import java.io.File; 8 | 9 | /** 10 | * 在windows和linux系统下均可正常使用 11 | * Create by Martin 2018/6/6/006 14:51 12 | */ 13 | public class PathUtil { 14 | //获取项目的根路径 15 | public final static String classPath; 16 | 17 | static { 18 | //获取的是classpath路径,适用于读取resources下资源 19 | // classPath = Thread.currentThread().getContextClassLoader().getResource("").getPath(); 20 | classPath = System.getProperty("user.dir"); 21 | } 22 | 23 | /** 24 | * 项目根目录 25 | */ 26 | public static String getRootPath() { 27 | return RootPath(""); 28 | } 29 | 30 | /** 31 | * 自定义追加路径 32 | */ 33 | public static String getRootPath(String u_path) { 34 | return RootPath("/" + u_path); 35 | } 36 | 37 | /** 38 | * 私有处理方法 39 | */ 40 | private static String RootPath(String u_path) { 41 | String rootPath = ""; 42 | //windows下 43 | if ("\\".equals(File.separator)) { 44 | //System.out.println(classPath); 45 | rootPath = classPath + u_path; 46 | rootPath = rootPath.replaceAll("/", "\\\\"); 47 | if (rootPath.substring(0, 1).equals("\\")) { 48 | rootPath = rootPath.substring(1); 49 | } 50 | } 51 | //linux下 52 | if ("/".equals(File.separator)) { 53 | //System.out.println(classPath); 54 | rootPath = classPath + u_path; 55 | rootPath = rootPath.replaceAll("\\\\", "/"); 56 | } 57 | return rootPath; 58 | } 59 | 60 | //更多扩展方法任你发挥 61 | 62 | } 63 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/dump/DumpController.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.dump; 2 | 3 | import com.github.onblog.java_monitor.core.order.Jmap; 4 | import com.github.onblog.java_monitor.core.order.Jstack; 5 | import org.apache.commons.io.FileUtils; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.http.HttpHeaders; 9 | import org.springframework.http.HttpStatus; 10 | import org.springframework.http.MediaType; 11 | import org.springframework.http.ResponseEntity; 12 | import org.springframework.stereotype.Controller; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | 15 | import java.io.File; 16 | import java.io.IOException; 17 | 18 | /** 19 | * Create by Martin 2018/11/14 0014 22:51 20 | */ 21 | @Controller 22 | public class DumpController { 23 | private Logger logger = LoggerFactory.getLogger(getClass().getName()); 24 | 25 | @RequestMapping("/heap") 26 | public ResponseEntity heapDump(String id) throws IOException { 27 | assert id!=null&&id!=""; 28 | String dump = Jmap.dump(id); 29 | File file = new File(dump); 30 | logger.debug("DownLoad Dump:"+dump); 31 | HttpHeaders headers = new HttpHeaders(); 32 | headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); 33 | headers.setContentDispositionFormData("attachment", file.getName()); 34 | return new ResponseEntity<>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED); 35 | } 36 | 37 | @RequestMapping("/thread") 38 | public ResponseEntity threadDump(String id) throws IOException { 39 | assert id!=null&&id!=""; 40 | String dump = Jstack.dump(id); 41 | File file = new File(dump); 42 | logger.debug("DownLoad Dump:"+dump); 43 | HttpHeaders headers = new HttpHeaders(); 44 | headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); 45 | headers.setContentDispositionFormData("attachment", file.getName()); 46 | return new ResponseEntity<>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/h2/dao/ClassLoadRespository.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.h2.dao; 2 | 3 | import com.github.onblog.java_monitor.h2.entity.ClassLoadEntity; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Create by Martin 2018/11/12 0012 21:38 11 | */ 12 | @Repository 13 | public interface ClassLoadRespository extends JpaRepository { 14 | List findAllByName(String name); 15 | } 16 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/h2/dao/GcRespository.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.h2.dao; 2 | 3 | import com.github.onblog.java_monitor.h2.entity.GcEntity; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Create by Martin 2018/11/12 0012 21:38 11 | */ 12 | @Repository 13 | public interface GcRespository extends JpaRepository { 14 | List findAllByName(String name); 15 | } 16 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/h2/dao/ThreadRespository.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.h2.dao; 2 | 3 | import com.github.onblog.java_monitor.h2.entity.ThreadEntity; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Create by Martin 2018/11/12 0012 21:38 11 | */ 12 | @Repository 13 | public interface ThreadRespository extends JpaRepository { 14 | List findAllByName(String name); 15 | } 16 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/h2/entity/ClassLoadEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.h2.entity; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Entity; 6 | import javax.persistence.GeneratedValue; 7 | import javax.persistence.Id; 8 | import javax.persistence.Table; 9 | 10 | /** 11 | * Create by Martin 2018/11/12 0012 20:59 12 | */ 13 | @Data 14 | @Entity 15 | @Table(name = "class_table") 16 | public class ClassLoadEntity { 17 | @Id 18 | @GeneratedValue 19 | private Integer id; 20 | private String name; //进程ID 21 | private String date; //x:时间 22 | private String Loaded; 23 | private String Bytes1; 24 | private String Unloaded; 25 | private String Bytes2; 26 | private String Time1; 27 | private String Compiled; 28 | private String Failed; 29 | private String Invalid; 30 | private String Time2; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/h2/entity/GcEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.h2.entity; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Entity; 6 | import javax.persistence.GeneratedValue; 7 | import javax.persistence.Id; 8 | import javax.persistence.Table; 9 | 10 | /** 11 | * Create by Martin 2018/11/12 0012 20:39 12 | */ 13 | @Data 14 | @Entity 15 | @Table(name = "gc_table") 16 | public class GcEntity { 17 | @Id 18 | @GeneratedValue 19 | private Integer id; 20 | private String name; //进程ID 21 | private String date; //x:时间 22 | private String S0C; 23 | private String S1C; 24 | private String S0U; 25 | private String S1U; 26 | private String EC; 27 | private String EU; 28 | private String OC; 29 | private String OU; 30 | private String MC;//PC 31 | private String MU;//PU 32 | private String CCSC; 33 | private String CCSU; 34 | private String YGC; 35 | private String YGCT; 36 | private String FGC; 37 | private String FGCT; 38 | private String GCT; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/h2/entity/ThreadEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.h2.entity; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Entity; 6 | import javax.persistence.GeneratedValue; 7 | import javax.persistence.Id; 8 | import javax.persistence.Table; 9 | 10 | /** 11 | * Create by Martin 2018/11/12 0012 21:32 12 | */ 13 | @Data 14 | @Entity 15 | @Table(name = "thread_table") 16 | public class ThreadEntity { 17 | @Id 18 | @GeneratedValue 19 | private Integer id; 20 | private String name; //进程ID 21 | private String date; //x:时间 22 | private int total; 23 | private int RUNNABLE; 24 | private int TIMED_WAITING; 25 | private int WAITING; 26 | } 27 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/h2/service/ClassService.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.h2.service; 2 | 3 | import com.github.onblog.java_monitor.core.entity.KVEntity; 4 | import com.github.onblog.java_monitor.h2.dao.ClassLoadRespository; 5 | import com.github.onblog.java_monitor.h2.entity.ClassLoadEntity; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Create by Martin 2018/11/12 0012 21:55 13 | */ 14 | @Service 15 | public class ClassService { 16 | @Autowired 17 | private ClassLoadRespository classLoadRespository; 18 | 19 | public List findAllByName(String name) { 20 | return classLoadRespository.findAllByName(name); 21 | } 22 | 23 | 24 | public void write(String name, String date, List jstatClass) { 25 | ClassLoadEntity entity = new ClassLoadEntity(); 26 | entity.setName(name); 27 | entity.setDate(date); 28 | entity.setLoaded(jstatClass.get(0).getValue()); 29 | entity.setBytes1(jstatClass.get(1).getValue()); 30 | entity.setUnloaded(jstatClass.get(2).getValue()); 31 | entity.setBytes2(jstatClass.get(3).getValue()); 32 | entity.setTime1(jstatClass.get(4).getValue()); 33 | entity.setCompiled(jstatClass.get(5).getValue()); 34 | entity.setFailed(jstatClass.get(6).getValue()); 35 | entity.setInvalid(jstatClass.get(7).getValue()); 36 | entity.setTime2(jstatClass.get(8).getValue()); 37 | classLoadRespository.save(entity); 38 | } 39 | 40 | public void clearAll() { 41 | classLoadRespository.deleteAll(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/h2/service/GcService.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.h2.service; 2 | 3 | import com.github.onblog.java_monitor.core.entity.KVEntity; 4 | import com.github.onblog.java_monitor.h2.dao.GcRespository; 5 | import com.github.onblog.java_monitor.h2.entity.GcEntity; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Create by Martin 2018/11/12 0012 21:54 13 | */ 14 | @Service 15 | public class GcService { 16 | @Autowired 17 | private GcRespository gcRespository; 18 | 19 | public void write(String name, String date, List kvEntities) { 20 | GcEntity entity = new GcEntity(); 21 | entity.setName(name); 22 | entity.setDate(date); 23 | entity.setS0C(kvEntities.get(0).getValue()); 24 | entity.setS1C(kvEntities.get(1).getValue()); 25 | entity.setS0U(kvEntities.get(2).getValue()); 26 | entity.setS1U(kvEntities.get(3).getValue()); 27 | entity.setEC(kvEntities.get(4).getValue()); 28 | entity.setEU(kvEntities.get(5).getValue()); 29 | entity.setOC(kvEntities.get(6).getValue()); 30 | entity.setOU(kvEntities.get(7).getValue()); 31 | entity.setMC(kvEntities.get(8).getValue()); 32 | entity.setMU(kvEntities.get(9).getValue()); 33 | entity.setCCSC(kvEntities.get(10).getValue()); 34 | entity.setCCSU(kvEntities.get(11).getValue()); 35 | entity.setYGC(kvEntities.get(12).getValue()); 36 | entity.setYGCT(kvEntities.get(13).getValue()); 37 | entity.setFGC(kvEntities.get(14).getValue()); 38 | entity.setFGCT(kvEntities.get(15).getValue()); 39 | entity.setGCT(kvEntities.get(16).getValue()); 40 | gcRespository.save(entity); 41 | } 42 | 43 | public List findAllByName(String name) { 44 | return gcRespository.findAllByName(name); 45 | } 46 | 47 | public void clearAll() { 48 | gcRespository.deleteAll(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/h2/service/ThreadService.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.h2.service; 2 | 3 | import com.github.onblog.java_monitor.core.entity.JstackEntity; 4 | import com.github.onblog.java_monitor.h2.dao.ThreadRespository; 5 | import com.github.onblog.java_monitor.h2.entity.ThreadEntity; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Create by Martin 2018/11/12 0012 21:56 13 | */ 14 | @Service 15 | public class ThreadService { 16 | @Autowired 17 | private ThreadRespository threadRespository; 18 | 19 | public List findAllByName(String name) { 20 | return threadRespository.findAllByName(name); 21 | } 22 | 23 | public void write(String name, String date, JstackEntity jstatk) { 24 | ThreadEntity entity = new ThreadEntity(); 25 | entity.setName(name); 26 | entity.setDate(date); 27 | entity.setTotal(jstatk.getTotal()); 28 | entity.setRUNNABLE(jstatk.getRUNNABLE()); 29 | entity.setTIMED_WAITING(jstatk.getTIMED_WAITING()); 30 | entity.setWAITING(jstatk.getWAITING()); 31 | threadRespository.save(entity); 32 | } 33 | 34 | public void clear() { 35 | 36 | } 37 | 38 | public void clearAll() { 39 | threadRespository.deleteAll(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/html/Controllers.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.html; 2 | 3 | import com.github.onblog.java_monitor.core.order.Javav; 4 | import com.github.onblog.java_monitor.core.order.Jps; 5 | import com.github.onblog.java_monitor.core.entity.JpsEntity; 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.ui.ModelMap; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | 10 | import java.util.Map; 11 | 12 | /** 13 | * Create by Martin 2018/11/12 0012 23:29 14 | */ 15 | @Controller 16 | public class Controllers { 17 | 18 | @RequestMapping(value = "/") 19 | public String index(ModelMap model){ 20 | Map jps = Jps.jps(); 21 | model.addAttribute("jps",jps); 22 | return "index"; 23 | } 24 | 25 | @RequestMapping(value = "/main") 26 | public String main(ModelMap model){ 27 | model.addAttribute("jps",Jps.jps()); 28 | model.addAttribute("version",Javav.version()); 29 | return "main"; 30 | } 31 | 32 | @RequestMapping(value = "/monitor") 33 | public String monitor(){ 34 | return "monitor"; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/socket/config/WebSocketConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.socket.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.messaging.simp.config.MessageBrokerRegistry; 5 | import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker; 6 | import org.springframework.web.socket.config.annotation.StompEndpointRegistry; 7 | import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer; 8 | 9 | @Configuration 10 | @EnableWebSocketMessageBroker 11 | public class WebSocketConfig implements WebSocketMessageBrokerConfigurer { 12 | 13 | @Override 14 | public void configureMessageBroker(MessageBrokerRegistry config) { 15 | config.enableSimpleBroker("/topic"); 16 | config.setApplicationDestinationPrefixes("/app"); 17 | } 18 | 19 | @Override 20 | public void registerStompEndpoints(StompEndpointRegistry registry) { 21 | registry.addEndpoint("/websocket").withSockJS(); 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/socket/controller/GreetingController.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.socket.controller; 2 | 3 | 4 | import com.github.onblog.java_monitor.h2.entity.ClassLoadEntity; 5 | import com.github.onblog.java_monitor.h2.entity.GcEntity; 6 | import com.github.onblog.java_monitor.h2.entity.ThreadEntity; 7 | import com.github.onblog.java_monitor.h2.service.ClassService; 8 | import com.github.onblog.java_monitor.h2.service.GcService; 9 | import com.github.onblog.java_monitor.h2.service.ThreadService; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.messaging.handler.annotation.MessageMapping; 12 | import org.springframework.messaging.handler.annotation.SendTo; 13 | import org.springframework.messaging.simp.SimpMessagingTemplate; 14 | import org.springframework.stereotype.Controller; 15 | 16 | import java.util.List; 17 | 18 | /** 19 | * Create by Martin 2018/6/19/019 23:49 20 | */ 21 | @Controller 22 | public class GreetingController { 23 | @Autowired 24 | private SimpMessagingTemplate messagingTemplate; 25 | @Autowired 26 | private GcService gcService; 27 | @Autowired 28 | private ClassService classService; 29 | @Autowired 30 | private ThreadService threadService; 31 | 32 | @MessageMapping("/gc") 33 | @SendTo("/topic/gc") 34 | public List socketGc(String name){ 35 | return gcService.findAllByName(name); 36 | } 37 | 38 | @MessageMapping("/cl") 39 | @SendTo("/topic/cl") 40 | public List socketCl(String name){ 41 | return classService.findAllByName(name); 42 | } 43 | 44 | @MessageMapping("/thread") 45 | @SendTo("/topic/thread") 46 | public List socketThread(String name){ 47 | return threadService.findAllByName(name); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/timer/job/ClearDumpJob.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.timer.job; 2 | 3 | import com.github.onblog.java_monitor.core.util.PathUtil; 4 | import org.apache.commons.io.FileUtils; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.scheduling.annotation.Scheduled; 8 | import org.springframework.stereotype.Component; 9 | 10 | import java.io.File; 11 | import java.io.IOException; 12 | 13 | /** 14 | * Create by Martin 2018/11/15 0015 12:12 15 | */ 16 | @Component 17 | public class ClearDumpJob { 18 | private Logger logger = LoggerFactory.getLogger(getClass().getName()); 19 | 20 | /** 21 | * 清理快照目录 22 | */ 23 | @Scheduled(cron="0 0 0 * * ?") 24 | public void clearDump() { 25 | String path = PathUtil.getRootPath("dump/"); 26 | File file = new File(path); 27 | if (!file.exists()){ 28 | return; 29 | } 30 | try { 31 | FileUtils.deleteDirectory(file); 32 | logger.warn("Delete dump directory successful"); 33 | } catch (IOException e) { 34 | e.printStackTrace(); 35 | } 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/timer/job/ClearJob.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.timer.job; 2 | 3 | import com.github.onblog.java_monitor.h2.service.ClassService; 4 | import com.github.onblog.java_monitor.h2.service.GcService; 5 | import com.github.onblog.java_monitor.h2.service.ThreadService; 6 | import org.quartz.JobExecutionContext; 7 | import org.quartz.JobExecutionException; 8 | import org.slf4j.Logger; 9 | import org.slf4j.LoggerFactory; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.scheduling.quartz.QuartzJobBean; 12 | 13 | /** 14 | * Create by Martin 2018/11/14 0014 21:01 15 | */ 16 | public class ClearJob extends QuartzJobBean { 17 | private Logger logger = LoggerFactory.getLogger(getClass().getName()); 18 | 19 | @Autowired 20 | private GcService gcService; 21 | @Autowired 22 | private ClassService classService; 23 | @Autowired 24 | private ThreadService threadService; 25 | 26 | @Override 27 | protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException { 28 | logger.warn("Clear all data on a regular basis"); 29 | gcService.clearAll(); 30 | classService.clearAll(); 31 | threadService.clearAll(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/timer/parm/CronParm.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.timer.parm; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | * Create by Martin 2018/11/14 0014 21:18 9 | */ 10 | @Component 11 | @ConfigurationProperties(prefix="monitor") 12 | @Data 13 | public class CronParm { 14 | private String cron; 15 | private Integer rate; 16 | } 17 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/java/com/github/onblog/java_monitor/timer/util/TimerUtil.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.timer.util; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | /** 7 | * Create by Martin 2018/11/14 0014 21:02 8 | */ 9 | public class TimerUtil { 10 | /** 11 | * 现在时间 12 | * @return 13 | */ 14 | public static String time(){ 15 | SimpleDateFormat format = new SimpleDateFormat("MM/dd HH:mm"); 16 | return format.format(new Date()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8888 2 | spring.datasource.driver-class-name=org.h2.Driver 3 | spring.datasource.url=jdbc:h2:~/JMDataBase/monitor 4 | spring.datasource.username=root 5 | spring.datasource.password=123456 6 | spring.jpa.show-sql=false 7 | spring.jpa.hibernate.ddl-auto=update 8 | monitor.rate=60 9 | monitor.cron=0 0 0 * * ? -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/ico/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/ico/favicon.ico -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/js/ccsc.js: -------------------------------------------------------------------------------- 1 | function ccsc(data) { 2 | var myChart = echarts.init(document.getElementById('ccsc'));//(1) 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/KB', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: white 36 | } 37 | }], 38 | series: [ 39 | { 40 | name: "CCSC",//(2) 41 | type: 'line', 42 | data: data.map(function (item) { 43 | return item.ccsc; 44 | }), 45 | lineStyle: { 46 | color: colors[0] 47 | } 48 | }, 49 | { 50 | name: "CCSU",//(3) 51 | type: 'line', 52 | data: data.map(function (item) { 53 | return item.ccsu 54 | }), 55 | lineStyle: { 56 | color: colors[1] 57 | } 58 | }] 59 | }); 60 | } -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/js/classn.js: -------------------------------------------------------------------------------- 1 | function classn(data) { 2 | var myChart = echarts.init(document.getElementById('classn'));//(1) 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/个', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: white 36 | } 37 | }], 38 | series: [ 39 | { 40 | name: "Loaded",//(2) 41 | type: 'line', 42 | data: data.map(function (item) { 43 | return item.loaded; 44 | }), 45 | lineStyle: { 46 | color: colors[0] 47 | }, 48 | markLine: { 49 | } 50 | }, 51 | { 52 | name: "UnLoaded",//(3) 53 | type: 'line', 54 | data: data.map(function (item) { 55 | return item.unloaded 56 | }), 57 | lineStyle: { 58 | color: colors[1] 59 | } 60 | }] 61 | }); 62 | } -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/js/classt.js: -------------------------------------------------------------------------------- 1 | function classt(data) { 2 | var myChart = echarts.init(document.getElementById('classt'));//(1) 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/秒', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: [colors[0]] 36 | } 37 | }], 38 | series: [ 39 | { 40 | name: "Time",//(2) 41 | type: 'line', 42 | data: data.map(function (item) { 43 | return item.time1; 44 | }), 45 | lineStyle: { 46 | color: colors[0] 47 | } 48 | }] 49 | }); 50 | } -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/js/combyte.js: -------------------------------------------------------------------------------- 1 | function combyte(data) { 2 | var myChart = echarts.init(document.getElementById('combyte'));//(1) 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/KB', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: white, 36 | symbolSize: [0, 5] 37 | } 38 | }], 39 | series: [ 40 | { 41 | name: "Loaded",//(2) 42 | type: 'line', 43 | data: data.map(function (item) { 44 | return item.bytes1; 45 | }), 46 | lineStyle: { 47 | color: colors[0] 48 | } 49 | }, 50 | { 51 | name: "Unloaded",//(3) 52 | type: 'line', 53 | data: data.map(function (item) { 54 | return item.bytes2 55 | }), 56 | lineStyle: { 57 | color: colors[1] 58 | } 59 | }] 60 | }); 61 | } -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/js/comt.js: -------------------------------------------------------------------------------- 1 | function comt(data) { 2 | var myChart = echarts.init(document.getElementById('comt'));//(1) 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/秒', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: [colors[0]] 36 | } 37 | }], 38 | series: [ 39 | { 40 | name: "Time",//(2) 41 | type: 'line', 42 | data: data.map(function (item) { 43 | return item.time2; 44 | }), 45 | lineStyle: { 46 | color: colors[0] 47 | } 48 | }] 49 | }); 50 | } -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/js/eden.js: -------------------------------------------------------------------------------- 1 | function eden(data) { 2 | var myChart = echarts.init(document.getElementById('eden')); 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/KB', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: white 36 | } 37 | }], 38 | series: [ 39 | { 40 | name: "EC", 41 | type: 'line', 42 | data: data.map(function (item) { 43 | return item.ec; 44 | }), 45 | lineStyle: { 46 | color: colors[0] 47 | } 48 | }, 49 | { 50 | name: "EU", 51 | type: 'line', 52 | data: data.map(function (item) { 53 | return item.eu; 54 | }), 55 | lineStyle: { 56 | color: colors[1] 57 | } 58 | }] 59 | }); 60 | } -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/js/gcn.js: -------------------------------------------------------------------------------- 1 | function gcn(data) { 2 | var myChart = echarts.init(document.getElementById('gcn'));//(1) 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/次', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: white 36 | } 37 | }], 38 | series: [ 39 | { 40 | name: "YGC",//(2) 41 | type: 'line', 42 | data: data.map(function (item) { 43 | return item.ygc; 44 | }), 45 | lineStyle: { 46 | color: colors[0] 47 | } 48 | }, 49 | { 50 | name: "FGC",//(3) 51 | type: 'line', 52 | data: data.map(function (item) { 53 | return item.fgc 54 | }), 55 | lineStyle: { 56 | color: colors[1] 57 | } 58 | }] 59 | }); 60 | } -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/js/mc.js: -------------------------------------------------------------------------------- 1 | function mc(data) { 2 | var myChart = echarts.init(document.getElementById('mc')); 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/KB', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: white 36 | } 37 | }], 38 | series: [ 39 | { 40 | name: "MC", 41 | type: 'line', 42 | data: data.map(function (item) { 43 | return item.mc; 44 | }), 45 | lineStyle: { 46 | color: colors[0] 47 | } 48 | }, 49 | { 50 | name: "MU", 51 | type: 'line', 52 | data: data.map(function (item) { 53 | return item.mu; 54 | }), 55 | lineStyle: { 56 | color: colors[1] 57 | } 58 | }] 59 | }); 60 | } -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/js/old.js: -------------------------------------------------------------------------------- 1 | function old(data) { 2 | var myChart = echarts.init(document.getElementById('old')); 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/KB', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: white 36 | } 37 | }], 38 | series: [ 39 | { 40 | name: "OC", 41 | type: 'line', 42 | data: data.map(function (item) { 43 | return item.oc; 44 | }), 45 | lineStyle: { 46 | color: colors[0] 47 | } 48 | }, 49 | { 50 | name: "OU", 51 | type: 'line', 52 | data: data.map(function (item) { 53 | return item.ou; 54 | }), 55 | lineStyle: { 56 | color: colors[1] 57 | } 58 | }] 59 | }); 60 | } -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/js/s0.js: -------------------------------------------------------------------------------- 1 | function s0(data) { 2 | var myChart = echarts.init(document.getElementById('s0')); 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/KB', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: white 36 | } 37 | }], 38 | series: [ 39 | { 40 | name: "SOC", 41 | type: 'line', 42 | data: data.map(function (item) { 43 | return item.s0C; 44 | }), 45 | lineStyle: { 46 | color: colors[0] 47 | } 48 | }, 49 | { 50 | name: "SOU", 51 | type: 'line', 52 | data: data.map(function (item) { 53 | return item.s0U; 54 | }), 55 | lineStyle: { 56 | color: colors[1] 57 | } 58 | }] 59 | }); 60 | } -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/js/s1.js: -------------------------------------------------------------------------------- 1 | function s1(data) { 2 | var myChart = echarts.init(document.getElementById('s1')); 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/KB', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: white 36 | } 37 | }], 38 | series: [ 39 | { 40 | name: "S1C", 41 | type: 'line', 42 | data: data.map(function (item) { 43 | return item.s1C; 44 | }), 45 | lineStyle: { 46 | color: colors[0] 47 | } 48 | }, 49 | { 50 | name: "S1U", 51 | type: 'line', 52 | data: data.map(function (item) { 53 | return item.s1U; 54 | }), 55 | lineStyle: { 56 | color: colors[1] 57 | } 58 | }] 59 | }); 60 | } -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/js/util.js: -------------------------------------------------------------------------------- 1 | //获取URL参数 2 | function GetQueryString(name) { 3 | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); 4 | var r = window.location.search.substr(1).match(reg); 5 | if (r != null) return decodeURI(r[2]); 6 | return null; 7 | } 8 | 9 | //折线颜色 10 | var colors = ['#cc0033', '#ff5722', '#2196f3', '#4caf50']; 11 | //点 12 | var white = null; 13 | //背景色 14 | var background_color = '#21202D'; 15 | 16 | var my_tooltip = { 17 | trigger: 'axis', 18 | axisPointer: { 19 | animation: false, 20 | type: 'cross', 21 | lineStyle: { 22 | color: '#376df4', 23 | width: 2, 24 | opacity: 1 25 | } 26 | } 27 | }; 28 | var my_toolbox ={ 29 | left: 'center', 30 | feature: { 31 | dataZoom: { 32 | yAxisIndex: 'none' 33 | }, 34 | restore: {}, 35 | saveAsImage: {}, 36 | magicType: { 37 | type: [] 38 | } 39 | } 40 | }; 41 | //下载快照 42 | $("#heap_button").click(function () { 43 | window.open("/heap?id="+GetQueryString("pid")); 44 | }); 45 | $("#thread_button").click(function () { 46 | window.open("/thread?id="+GetQueryString("pid")); 47 | }); -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/css/modules/code.css: -------------------------------------------------------------------------------- 1 | /** layui-v2.4.3 MIT License By https://www.layui.com */ 2 | html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none} -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/css/modules/layer/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/css/modules/layer/default/icon-ext.png -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/css/modules/layer/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/css/modules/layer/default/icon.png -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/css/modules/layer/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/css/modules/layer/default/loading-0.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/css/modules/layer/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/css/modules/layer/default/loading-1.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/css/modules/layer/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/css/modules/layer/default/loading-2.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/font/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/font/iconfont.eot -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/font/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/font/iconfont.ttf -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/font/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/font/iconfont.woff -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/0.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/1.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/10.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/10.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/11.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/11.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/12.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/12.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/13.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/13.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/14.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/14.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/15.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/15.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/16.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/17.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/17.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/18.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/18.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/19.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/19.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/2.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/20.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/20.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/21.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/21.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/22.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/22.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/23.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/23.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/24.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/25.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/25.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/26.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/26.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/27.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/27.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/28.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/28.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/29.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/29.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/3.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/30.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/30.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/31.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/31.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/32.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/32.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/33.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/33.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/34.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/34.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/35.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/35.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/36.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/36.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/37.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/37.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/38.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/38.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/39.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/39.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/4.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/40.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/40.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/41.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/41.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/42.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/42.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/43.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/43.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/44.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/44.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/45.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/45.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/46.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/46.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/47.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/47.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/48.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/48.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/49.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/49.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/5.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/50.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/50.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/51.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/51.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/52.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/52.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/53.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/53.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/54.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/54.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/55.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/55.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/56.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/56.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/57.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/57.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/58.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/58.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/59.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/59.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/6.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/60.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/60.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/61.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/61.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/62.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/62.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/63.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/63.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/64.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/64.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/65.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/65.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/66.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/66.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/67.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/67.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/68.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/68.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/69.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/69.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/7.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/70.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/70.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/71.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/71.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/8.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/images/face/9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitor/src/main/resources/static/lib/layui/images/face/9.gif -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/lay/modules/code.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.4.3 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var a=layui.$,l="http://www.layui.com/doc/modules/code.html";e("code",function(e){var t=[];e=e||{},e.elem=a(e.elem||".layui-code"),e.about=!("about"in e)||e.about,e.elem.each(function(){t.push(this)}),layui.each(t.reverse(),function(t,i){var c=a(i),o=c.html();(c.attr("lay-encode")||e.encode)&&(o=o.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")),c.html('
  1. '+o.replace(/[\r\t\n]+/g,"
  2. ")+"
"),c.find(">.layui-code-h3")[0]||c.prepend('

'+(c.attr("lay-title")||e.title||"code")+(e.about?'layui.code':"")+"

");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss"); -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/lay/modules/flow.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.4.3 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="加载更多",h=l('");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;su)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)}); -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/static/lib/layui/lay/modules/laytpl.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.4.3 MIT License By https://www.layui.com */ 2 | ;layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)}); -------------------------------------------------------------------------------- /JavaMonitor/src/main/resources/templates/main.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 进程列表 6 | 7 | 8 | 26 | 27 |
28 |
29 |
30 |
31 |
32 | 33 | 首页 / 进程列表 34 | v1.0 35 |
36 |
37 |
38 |
39 |
40 |
41 | 42 |
43 |
44 |

45 |
46 |

VM Flags:

47 |

48 |
49 |
50 |
51 | 52 |
53 | 54 | 55 | -------------------------------------------------------------------------------- /JavaMonitor/src/test/java/com/github/onblog/java_monitor/JavaMonitorApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 6 | import org.springframework.test.context.web.WebAppConfiguration; 7 | 8 | @RunWith(SpringJUnit4ClassRunner.class) 9 | @WebAppConfiguration 10 | public class JavaMonitorApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /JavaMonitor/src/test/java/com/github/onblog/java_monitor/core/order/Tools.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.java_monitor.core.order; 2 | 3 | import com.github.onblog.java_monitor.core.cmd.ExecuteCmd; 4 | import org.junit.Test; 5 | 6 | import java.lang.management.ManagementFactory; 7 | import java.lang.management.OperatingSystemMXBean; 8 | 9 | /** 10 | * Create by Martin 2018/11/17 0017 13:03 11 | */ 12 | public class Tools { 13 | 14 | @Test 15 | public void system(){ 16 | OperatingSystemMXBean operatingSystem = ManagementFactory.getOperatingSystemMXBean(); 17 | System.out.println("系统名称"+operatingSystem.getName()); 18 | System.out.println("位数"+operatingSystem.getArch()); 19 | System.out.println("处理器数"+operatingSystem.getAvailableProcessors()); 20 | System.out.println("操作系统版本"+operatingSystem.getVersion()); 21 | } 22 | 23 | @Test 24 | public void toolsTest() throws InterruptedException { 25 | String s = ExecuteCmd.execute(new String[]{"java", "sun.tools.jinfo.JInfo"}); 26 | System.out.println(s); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/ClientApplication.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.scheduling.annotation.EnableScheduling; 6 | 7 | @SpringBootApplication 8 | @EnableScheduling 9 | public class ClientApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(ClientApplication.class, args); 13 | } 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/core/cmd/ExecuteCmd.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client.core.cmd; 2 | 3 | import java.io.BufferedInputStream; 4 | import java.io.BufferedReader; 5 | import java.io.InputStreamReader; 6 | 7 | /** 8 | * Create by Martin 2018/11/9 0009 22:28 9 | */ 10 | public class ExecuteCmd { 11 | /** 12 | * 执行外部程序,并获取标准输出 13 | */ 14 | public static String execute(String[] cmd,String... encoding) { 15 | BufferedReader bufferedReader; 16 | InputStreamReader inputStreamReader; 17 | try { 18 | Process p = Runtime.getRuntime().exec(cmd); 19 | 20 | /* 为"错误输出流"单独开一个线程读取之,否则会造成标准输出流的阻塞 */ 21 | Thread t = new Thread(new InputStreamRunnable(p.getErrorStream(), "ErrorStream")); 22 | t.start(); 23 | 24 | /* "标准输出流"就在当前方法中读取 */ 25 | BufferedInputStream bis = new BufferedInputStream(p.getInputStream()); 26 | 27 | if (encoding != null && encoding.length != 0) { 28 | inputStreamReader = new InputStreamReader(bis, encoding[0]);// 设置编码方式 29 | } else { 30 | inputStreamReader = new InputStreamReader(bis, "utf-8"); 31 | } 32 | bufferedReader = new BufferedReader(inputStreamReader); 33 | 34 | StringBuilder sb = new StringBuilder(); 35 | String line; 36 | 37 | while ((line = bufferedReader.readLine()) != null) { 38 | sb.append(line); 39 | sb.append("\n"); 40 | } 41 | 42 | bufferedReader.close(); 43 | p.destroy(); 44 | return sb.toString(); 45 | } catch (Exception e) { 46 | e.printStackTrace(); 47 | return null; 48 | } 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/core/cmd/InputStreamRunnable.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client.core.cmd; 2 | 3 | import java.io.BufferedInputStream; 4 | import java.io.BufferedReader; 5 | import java.io.InputStream; 6 | import java.io.InputStreamReader; 7 | 8 | /** 9 | * Create by Martin 2018/11/9 0009 22:32 10 | */ 11 | class InputStreamRunnable implements Runnable { 12 | private BufferedReader bReader = null; 13 | 14 | InputStreamRunnable(InputStream is, String type) { 15 | try { 16 | bReader = new BufferedReader(new InputStreamReader(new BufferedInputStream(is), "UTF-8")); 17 | } catch (Exception ex) { 18 | ex.printStackTrace(); 19 | } 20 | } 21 | 22 | public void run() { 23 | String line; 24 | int num = 1; 25 | try { 26 | while ((line = bReader.readLine()) != null) { 27 | //System.out.println("---->"+String.format("%02d",num++)+" "+line); 28 | } 29 | bReader.close(); 30 | } catch (Exception ex) { 31 | ex.printStackTrace(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/core/entity/JinfoEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client.core.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Create by Martin 2018/11/15 0015 14:27 9 | */ 10 | @Data 11 | public class JinfoEntity { 12 | private List noedefault; 13 | private List commandLine; 14 | 15 | public JinfoEntity(List noedefault, List commandLine) { 16 | this.noedefault = noedefault; 17 | this.commandLine = commandLine; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/core/entity/JpsEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client.core.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Create by Martin 2018/10/22 21:47 9 | */ 10 | @Data 11 | public class JpsEntity { 12 | private String className; //全名 13 | private String smallName; //小名 14 | private List parameters; //参数 15 | 16 | public JpsEntity(String className, String smallName, List parameters) { 17 | this.className = className; 18 | this.smallName = smallName; 19 | this.parameters = parameters; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/core/entity/JstackEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client.core.entity; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * Create by Martin 2018/11/10 0010 17:54 7 | */ 8 | @Data 9 | public class JstackEntity { 10 | private String id; 11 | private int total; 12 | private int RUNNABLE; 13 | private int TIMED_WAITING; 14 | private int WAITING; 15 | 16 | public JstackEntity(String id, int total, int RUNNABLE, int TIMED_WAITING, int WAITING) { 17 | this.id = id; 18 | this.total = total; 19 | this.RUNNABLE = RUNNABLE; 20 | this.TIMED_WAITING = TIMED_WAITING; 21 | this.WAITING = WAITING; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/core/entity/KVEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client.core.entity; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * Create by Martin 2018/11/10 0010 14:51 7 | */ 8 | @Data 9 | public class KVEntity { 10 | private String key; 11 | private String value; 12 | 13 | public KVEntity(String key, String value) { 14 | this.key = key; 15 | this.value = value; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/core/order/Javav.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client.core.order; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | 7 | /** 8 | * Create by Martin 2018/11/15 0015 0:23 9 | */ 10 | public class Javav { 11 | 12 | public static String version(){ 13 | StringBuilder sb; 14 | try { 15 | Process p = Runtime.getRuntime().exec(new String[]{"java", "-version"}); 16 | InputStreamReader inputStreamReader = new InputStreamReader(p.getErrorStream()); 17 | BufferedReader bufferedReader = new BufferedReader(inputStreamReader); 18 | sb = new StringBuilder(); 19 | String line; 20 | while ((line = bufferedReader.readLine()) != null) { 21 | sb.append(line); 22 | sb.append("\n"); 23 | } 24 | bufferedReader.close(); 25 | p.destroy(); 26 | return sb.toString(); 27 | } catch (IOException e) { 28 | e.printStackTrace(); 29 | } 30 | return ""; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/core/order/Jinfo.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client.core.order; 2 | 3 | 4 | import com.github.onblog.client.core.cmd.ExecuteCmd; 5 | import com.github.onblog.client.core.entity.JinfoEntity; 6 | import com.github.onblog.client.core.util.ArrayUtil; 7 | 8 | import java.util.Arrays; 9 | import java.util.stream.Collectors; 10 | 11 | /** 12 | * Create by Martin 2018/11/15 0015 13:54 13 | */ 14 | public class Jinfo { 15 | 16 | 17 | /** 18 | * JVM默认参数与指定参数 19 | * @param id 20 | * @return 21 | */ 22 | public static JinfoEntity info(String id){ 23 | String s = ExecuteCmd.execute(new String[]{"jinfo","-flags", id}); 24 | if (!s.contains("successfully")){ 25 | return null; 26 | } 27 | String flags = "flags:"; 28 | String command = "Command line:"; 29 | //默认参数 30 | String[] noedefault = ArrayUtil.trim(s.substring(s.indexOf(flags)+flags.length(),s.indexOf(command)).split("\\s+")); 31 | String[] commandLine = null; 32 | s = s.substring(s.indexOf(command)); 33 | if (!s.equals(command)){ 34 | commandLine = s.substring(command.length()).split("\\s+"); 35 | } 36 | commandLine = ArrayUtil.trim(commandLine); 37 | return new JinfoEntity(Arrays.stream(noedefault).collect(Collectors.toList()), Arrays.stream(commandLine).collect(Collectors.toList()) ); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/core/order/Jmap.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client.core.order; 2 | 3 | import com.github.onblog.client.core.cmd.ExecuteCmd; 4 | import com.github.onblog.client.core.util.PathUtil; 5 | import com.github.onblog.client.dump.exception.DumpException; 6 | 7 | import java.io.File; 8 | import java.io.IOException; 9 | 10 | /** 11 | * Create by Martin 2018/11/14 0014 22:21 12 | */ 13 | public class Jmap { 14 | 15 | /** 16 | * 导出堆快照 17 | * @param id 18 | * @return 19 | */ 20 | public static String dump(String id) throws IOException { 21 | //判断NULL 22 | if (id==null||"".equals(id)){ 23 | throw new NullPointerException("参数id为NULL"); 24 | } 25 | //检验dump目录是否存在 26 | File dump = new File(PathUtil.getRootPath("dump/")); 27 | if (!dump.exists()){ 28 | dump.mkdirs(); 29 | } 30 | //若有已经存在的快照文件则删除 31 | String path = PathUtil.getRootPath("dump/"+id+"_heap.hprof"); 32 | File file = new File(path); 33 | if (file.exists()){ 34 | file.delete(); 35 | } 36 | //生成快照文件 37 | ExecuteCmd.execute(new String[]{"jmap","-dump:format=b,file="+path, id}); 38 | if (!file.exists()){ 39 | throw new DumpException(id); 40 | } 41 | return path; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/core/order/Jps.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client.core.order; 2 | 3 | 4 | import com.github.onblog.client.core.cmd.ExecuteCmd; 5 | import com.github.onblog.client.core.entity.JpsEntity; 6 | 7 | import java.util.Arrays; 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | import java.util.stream.Collectors; 11 | 12 | /** 13 | * Create by Martin 2018/10/22 20:22 14 | */ 15 | public class Jps { 16 | 17 | /** 18 | * Jps 命令结果 19 | * key:进程Id 20 | * @return map 21 | */ 22 | public static Map jps() { 23 | Map map = new HashMap<>(); 24 | String s = ExecuteCmd.execute(new String[]{"jps", "-l", "-v"}); 25 | String[] line = s != null ? s.split("\n") : new String[0]; 26 | for (String aLine : line) { 27 | String[] one = aLine.split("\\s+"); 28 | //排除sun.tools进程 29 | if (one[1].contains("sun.tools")){ 30 | continue; 31 | } 32 | //格式化控制台输出 33 | if (!one[1].substring(0, 1).equals("-")) { 34 | String smallName = one[1].contains(".") ? one[1].substring(one[1].lastIndexOf(".")+1) : one[1]; 35 | smallName = smallName.equalsIgnoreCase("jar")? one[1] : smallName; 36 | map.put(one[0], new JpsEntity(one[1], smallName, Arrays.stream(one).skip(2).collect(Collectors.toList()))); 37 | } else { 38 | map.put(one[0], new JpsEntity("NULL","NULL", Arrays.stream(one).skip(1).collect(Collectors.toList()))); 39 | } 40 | } 41 | return map; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/core/order/Jstack.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client.core.order; 2 | 3 | import com.github.onblog.client.core.cmd.ExecuteCmd; 4 | import com.github.onblog.client.core.entity.JstackEntity; 5 | import com.github.onblog.client.core.util.ArrayUtil; 6 | import com.github.onblog.client.core.util.PathUtil; 7 | import com.github.onblog.client.dump.exception.DumpException; 8 | import org.apache.commons.io.FileUtils; 9 | 10 | import java.io.File; 11 | import java.io.IOException; 12 | import java.nio.charset.Charset; 13 | 14 | /** 15 | * Create by Martin 2018/11/10 0010 17:59 16 | */ 17 | public class Jstack { 18 | private final static String prefix = "java.lang.Thread.State: "; 19 | /** 20 | * 该进程的线程信息 21 | * X轴为时间,Y轴为值的变化 22 | * @param id 23 | * @return 24 | */ 25 | public static JstackEntity jstack(String id) { 26 | String s = ExecuteCmd.execute(new String[]{"jstack", id}); 27 | int total= ArrayUtil.appearNumber(s, "nid="); 28 | int RUNNABLE = ArrayUtil.appearNumber(s, prefix+"RUNNABLE"); 29 | int TIMED_WAITING = ArrayUtil.appearNumber(s,prefix+"TIMED_WAITING"); 30 | int WAITING = ArrayUtil.appearNumber(s,prefix+"WAITING"); 31 | return new JstackEntity(id,total,RUNNABLE,TIMED_WAITING,WAITING); 32 | } 33 | 34 | /** 35 | * 导出线程快照 36 | * @param id 37 | * @return 38 | */ 39 | public static String dump(String id) throws IOException { 40 | //判断NULL 41 | if (id==null||"".equals(id)){ 42 | throw new NullPointerException("参数id为NULL"); 43 | } 44 | String path = PathUtil.getRootPath("dump/"+id+"_thread.txt"); 45 | String s = ExecuteCmd.execute(new String[]{"jstack", id}); 46 | //是否正常生成快照文件 47 | if (s.isEmpty()){ 48 | throw new DumpException(id); 49 | } 50 | File file = new File(path); 51 | FileUtils.write(file,s,Charset.forName("UTF-8")); 52 | return path; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/core/util/ArrayUtil.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client.core.util; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.regex.Matcher; 6 | import java.util.regex.Pattern; 7 | 8 | /** 9 | * Create by Martin 2018/11/10 0010 15:50 10 | */ 11 | public class ArrayUtil { 12 | 13 | /** 14 | * 去掉数组中空项 15 | * 16 | * @param olds 17 | * @return news 18 | */ 19 | public static String[] trim(String[] olds) { 20 | if (olds ==null ||olds.length == 0){ 21 | return olds; 22 | } 23 | List list = new ArrayList<>(); 24 | for (String old : olds) { 25 | if (old != null && !"".equals(old)) { 26 | list.add(old); 27 | } 28 | } 29 | String[] news = new String[list.size()]; 30 | for (int i = 0; i < list.size(); i++) { 31 | news[i] = list.get(i); 32 | } 33 | return news; 34 | } 35 | 36 | /** 37 | * 匹配字符出现次数 38 | * @param srcText 39 | * @param findText 40 | * @return 41 | */ 42 | public static int appearNumber(String srcText, String findText) { 43 | int count = 0; 44 | Pattern p = Pattern.compile(findText); 45 | Matcher m = p.matcher(srcText); 46 | while (m.find()) { 47 | count++; 48 | } 49 | return count; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/core/util/PathUtil.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client.core.util; 2 | 3 | /** 4 | * Create by Martin 2018/11/14 0014 22:34 5 | */ 6 | 7 | import java.io.File; 8 | 9 | /** 10 | * 在windows和linux系统下均可正常使用 11 | * Create by Martin 2018/6/6/006 14:51 12 | */ 13 | public class PathUtil { 14 | //获取项目的根路径 15 | public final static String classPath; 16 | 17 | static { 18 | //获取的是classpath路径,适用于读取resources下资源 19 | // classPath = Thread.currentThread().getContextClassLoader().getResource("").getPath(); 20 | classPath = System.getProperty("user.dir"); 21 | } 22 | 23 | /** 24 | * 项目根目录 25 | */ 26 | public static String getRootPath() { 27 | return RootPath(""); 28 | } 29 | 30 | /** 31 | * 自定义追加路径 32 | */ 33 | public static String getRootPath(String u_path) { 34 | return RootPath("/" + u_path); 35 | } 36 | 37 | /** 38 | * 私有处理方法 39 | */ 40 | private static String RootPath(String u_path) { 41 | String rootPath = ""; 42 | //windows下 43 | if ("\\".equals(File.separator)) { 44 | //system.out.println(classPath); 45 | rootPath = classPath + u_path; 46 | rootPath = rootPath.replaceAll("/", "\\\\"); 47 | if (rootPath.substring(0, 1).equals("\\")) { 48 | rootPath = rootPath.substring(1); 49 | } 50 | } 51 | //linux下 52 | if ("/".equals(File.separator)) { 53 | //system.out.println(classPath); 54 | rootPath = classPath + u_path; 55 | rootPath = rootPath.replaceAll("\\\\", "/"); 56 | } 57 | return rootPath; 58 | } 59 | 60 | //更多扩展方法任你发挥 61 | 62 | } 63 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/dump/DumpController.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client.dump; 2 | 3 | import com.github.onblog.client.core.order.Jmap; 4 | import com.github.onblog.client.core.order.Jstack; 5 | import org.apache.commons.io.FileUtils; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.http.HttpHeaders; 9 | import org.springframework.http.HttpStatus; 10 | import org.springframework.http.MediaType; 11 | import org.springframework.http.ResponseEntity; 12 | import org.springframework.stereotype.Controller; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | 15 | import java.io.File; 16 | import java.io.IOException; 17 | 18 | /** 19 | * Create by Martin 2018/11/14 0014 22:51 20 | */ 21 | @Controller 22 | public class DumpController { 23 | private Logger logger = LoggerFactory.getLogger(getClass().getName()); 24 | 25 | @RequestMapping("/heap") 26 | public ResponseEntity heapDump(String id) throws IOException { 27 | String dump = Jmap.dump(id); 28 | File file = new File(dump); 29 | logger.debug("DownLoad Dump:"+dump); 30 | HttpHeaders headers = new HttpHeaders(); 31 | headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); 32 | headers.setContentDispositionFormData("attachment", file.getName()); 33 | return new ResponseEntity<>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED); 34 | } 35 | 36 | @RequestMapping("/thread") 37 | public ResponseEntity threadDump(String id) throws IOException { 38 | String dump = Jstack.dump(id); 39 | File file = new File(dump); 40 | logger.debug("DownLoad Dump:"+dump); 41 | HttpHeaders headers = new HttpHeaders(); 42 | headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); 43 | headers.setContentDispositionFormData("attachment", file.getName()); 44 | return new ResponseEntity<>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/dump/exception/DumpException.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client.dump.exception; 2 | 3 | /** 4 | * Create by Martin 2019/3/3 0003 13:33 5 | */ 6 | public class DumpException extends RuntimeException { 7 | private String pid; 8 | 9 | public DumpException(String pid) { 10 | this.pid = pid; 11 | } 12 | 13 | public String getTip() { 14 | return "生成快照文件失败!进程号:"+pid+"
" 15 | +"建议重启应用!" +"
"+ 16 | "参考文章http://blog.51cto.com/zhangshaoxiong/1310166"; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/dump/exception/ExceptionHandle.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client.dump.exception; 2 | 3 | import org.springframework.web.bind.annotation.ControllerAdvice; 4 | import org.springframework.web.bind.annotation.ExceptionHandler; 5 | import org.springframework.web.bind.annotation.ResponseBody; 6 | 7 | /** 8 | * Create by Martin 2019/3/3 0003 13:35 9 | */ 10 | @ControllerAdvice 11 | public class ExceptionHandle { 12 | /** 13 | * 捕获异常 封装返回数据 14 | * 15 | * @return 16 | */ 17 | @ExceptionHandler(value = Exception.class) 18 | @ResponseBody 19 | public String handle(Exception e) { 20 | if (e instanceof DumpException) { 21 | DumpException exception = (DumpException) e; 22 | return exception.getTip(); 23 | }else { 24 | return e.getMessage(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/dump/timer/ClearDumpJob.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client.dump.timer; 2 | 3 | import com.github.onblog.client.core.util.PathUtil; 4 | import org.apache.commons.io.FileUtils; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.scheduling.annotation.Scheduled; 8 | import org.springframework.stereotype.Component; 9 | 10 | import java.io.File; 11 | import java.io.IOException; 12 | 13 | /** 14 | * Create by Martin 2018/12/31 0031 23:00 15 | */ 16 | @Component 17 | public class ClearDumpJob { 18 | private Logger logger = LoggerFactory.getLogger(getClass().getName()); 19 | 20 | /** 21 | * 清理快照目录 22 | */ 23 | @Scheduled(cron = "0 0 * * * ?") 24 | public void clearDump() { 25 | String path = PathUtil.getRootPath("dump/"); 26 | File file = new File(path); 27 | if (!file.exists()){ 28 | return; 29 | } 30 | try { 31 | FileUtils.deleteDirectory(file); 32 | logger.warn("Delete dump directory successful"); 33 | } catch (IOException e) { 34 | e.printStackTrace(); 35 | } 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/order/OrderController.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client.order; 2 | 3 | import com.github.onblog.client.core.entity.JinfoEntity; 4 | import com.github.onblog.client.core.entity.JpsEntity; 5 | import com.github.onblog.client.core.entity.JstackEntity; 6 | import com.github.onblog.client.core.entity.KVEntity; 7 | import com.github.onblog.client.core.order.*; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | /** 15 | * Create by Martin 2018/12/30 0030 16:44 16 | */ 17 | @RestController 18 | public class OrderController { 19 | 20 | @RequestMapping("/version") 21 | public String getVersion(){ 22 | return Javav.version(); 23 | } 24 | 25 | @RequestMapping("/info") 26 | public JinfoEntity getInfo(String id){ 27 | return Jinfo.info(id); 28 | } 29 | 30 | @RequestMapping("/jstack") 31 | public JstackEntity getJstack(String id){ 32 | return Jstack.jstack(id); 33 | } 34 | 35 | @RequestMapping("/jps") 36 | public Map getJps(){ 37 | return Jps.jps(); 38 | } 39 | 40 | @RequestMapping("/jstatclass") 41 | public List getJstatClass(String id) throws Exception { 42 | return Jstat.jstatClass(id); 43 | } 44 | 45 | @RequestMapping("/jstatgc") 46 | public List getJstatGc(String id) throws Exception { 47 | return Jstat.jstatGc(id); 48 | } 49 | 50 | @RequestMapping("/jstatutil") 51 | public List getJstatUtil(String id) throws Exception { 52 | return Jstat.jstatUtil(id); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/java/com/github/onblog/client/system/SystemController.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client.system; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | import java.lang.management.ManagementFactory; 7 | import java.lang.management.OperatingSystemMXBean; 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | 11 | /** 12 | * Create by Martin 2018/12/31 0031 21:25 13 | */ 14 | @RestController 15 | public class SystemController { 16 | 17 | @RequestMapping("/system") 18 | public Map getSystemMessage(){ 19 | Map map = new HashMap<>(); 20 | OperatingSystemMXBean operatingSystem = ManagementFactory.getOperatingSystemMXBean(); 21 | //系统名称 22 | map.put("Name",operatingSystem.getName()); 23 | //位数 24 | map.put("Arch",operatingSystem.getArch()); 25 | //处理器数 26 | map.put("AvailableProcessors",String.valueOf(operatingSystem.getAvailableProcessors())); 27 | //操作系统版本 28 | map.put("Version",operatingSystem.getVersion()); 29 | return map; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8081 -------------------------------------------------------------------------------- /JavaMonitorPlus/client/src/test/java/com/github/onblog/client/ClientApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.client; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class ClientApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/ServerApplication.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cache.annotation.EnableCaching; 6 | import org.springframework.scheduling.annotation.EnableScheduling; 7 | 8 | @SpringBootApplication 9 | @EnableScheduling 10 | @EnableCaching 11 | public class ServerApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(ServerApplication.class, args); 15 | } 16 | 17 | } 18 | 19 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/core/entity/JinfoEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.core.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Create by Martin 2018/11/15 0015 14:27 9 | */ 10 | @Data 11 | public class JinfoEntity { 12 | private List noedefault; 13 | private List commandLine; 14 | 15 | public JinfoEntity(){ 16 | 17 | } 18 | 19 | public JinfoEntity(List noedefault, List commandLine) { 20 | this.noedefault = noedefault; 21 | this.commandLine = commandLine; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/core/entity/JpsEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.core.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Create by Martin 2018/10/22 21:47 9 | */ 10 | @Data 11 | public class JpsEntity { 12 | private String className; //全名 13 | private String smallName; //小名 14 | private List parameters; //参数 15 | 16 | public JpsEntity(){ 17 | 18 | } 19 | 20 | public JpsEntity(String className, String smallName, List parameters) { 21 | this.className = className; 22 | this.smallName = smallName; 23 | this.parameters = parameters; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/core/entity/JstackEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.core.entity; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * Create by Martin 2018/11/10 0010 17:54 7 | */ 8 | @Data 9 | public class JstackEntity { 10 | private String id; 11 | private int total; 12 | private int RUNNABLE; 13 | private int TIMED_WAITING; 14 | private int WAITING; 15 | 16 | public JstackEntity(){ 17 | 18 | } 19 | 20 | public JstackEntity(String id, int total, int RUNNABLE, int TIMED_WAITING, int WAITING) { 21 | this.id = id; 22 | this.total = total; 23 | this.RUNNABLE = RUNNABLE; 24 | this.TIMED_WAITING = TIMED_WAITING; 25 | this.WAITING = WAITING; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/core/entity/KVEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.core.entity; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * Create by Martin 2018/11/10 0010 14:51 7 | */ 8 | @Data 9 | public class KVEntity { 10 | private String key; 11 | private String value; 12 | 13 | public KVEntity(){ 14 | 15 | } 16 | 17 | public KVEntity(String key, String value) { 18 | this.key = key; 19 | this.value = value; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/core/util/PathUtil.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.core.util; 2 | 3 | /** 4 | * Create by Martin 2018/11/14 0014 22:34 5 | */ 6 | 7 | import java.io.File; 8 | 9 | /** 10 | * 在windows和linux系统下均可正常使用 11 | * Create by Martin 2018/6/6/006 14:51 12 | */ 13 | public class PathUtil { 14 | //获取项目的根路径 15 | public final static String classPath; 16 | 17 | static { 18 | //获取的是classpath路径,适用于读取resources下资源 19 | // classPath = Thread.currentThread().getContextClassLoader().getResource("").getPath(); 20 | classPath = System.getProperty("user.dir"); 21 | } 22 | 23 | /** 24 | * 项目根目录 25 | */ 26 | public static String getRootPath() { 27 | return RootPath(""); 28 | } 29 | 30 | /** 31 | * 自定义追加路径 32 | */ 33 | public static String getRootPath(String u_path) { 34 | return RootPath("/" + u_path); 35 | } 36 | 37 | /** 38 | * 私有处理方法 39 | */ 40 | private static String RootPath(String u_path) { 41 | String rootPath = ""; 42 | //windows下 43 | if ("\\".equals(File.separator)) { 44 | //system.out.println(classPath); 45 | rootPath = classPath + u_path; 46 | rootPath = rootPath.replaceAll("/", "\\\\"); 47 | if (rootPath.substring(0, 1).equals("\\")) { 48 | rootPath = rootPath.substring(1); 49 | } 50 | } 51 | //linux下 52 | if ("/".equals(File.separator)) { 53 | //system.out.println(classPath); 54 | rootPath = classPath + u_path; 55 | rootPath = rootPath.replaceAll("\\\\", "/"); 56 | } 57 | return rootPath; 58 | } 59 | 60 | //更多扩展方法任你发挥 61 | 62 | } 63 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/database/dao/ClassLoadRespository.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.database.dao; 2 | 3 | 4 | import com.github.onblog.server.database.entity.ClassLoadEntity; 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Create by Martin 2018/11/12 0012 21:38 12 | */ 13 | @Repository 14 | public interface ClassLoadRespository extends JpaRepository { 15 | List findAllByAddressAndName(String address, String name); 16 | } 17 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/database/dao/GcRespository.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.database.dao; 2 | 3 | 4 | import com.github.onblog.server.database.entity.GcEntity; 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Create by Martin 2018/11/12 0012 21:38 12 | */ 13 | @Repository 14 | public interface GcRespository extends JpaRepository { 15 | List findAllByAddressAndName(String address, String name); 16 | } 17 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/database/dao/ThreadRespository.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.database.dao; 2 | 3 | import com.github.onblog.server.database.entity.ThreadEntity; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Create by Martin 2018/11/12 0012 21:38 11 | */ 12 | @Repository 13 | public interface ThreadRespository extends JpaRepository { 14 | List findAllByAddressAndName(String address, String name); 15 | } 16 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/database/entity/ClassLoadEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.database.entity; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.*; 6 | 7 | /** 8 | * Create by Martin 2018/11/12 0012 20:59 9 | */ 10 | @Data 11 | @Entity 12 | @Table(name = "class_table") 13 | public class ClassLoadEntity { 14 | @Id 15 | @GeneratedValue 16 | private Integer id; 17 | private String address; //进程所在主机 18 | private String name; //进程ID 19 | private String date; //x:时间 20 | private String Loaded; 21 | private String Bytes1; 22 | private String Unloaded; 23 | private String Bytes2; 24 | private String Time1; 25 | private String Compiled; 26 | private String Failed; 27 | private String Invalid; 28 | private String Time2; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/database/entity/GcEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.database.entity; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Entity; 6 | import javax.persistence.GeneratedValue; 7 | import javax.persistence.Id; 8 | import javax.persistence.Table; 9 | 10 | /** 11 | * Create by Martin 2018/11/12 0012 20:39 12 | */ 13 | @Data 14 | @Entity 15 | @Table(name = "gc_table") 16 | public class GcEntity { 17 | @Id 18 | @GeneratedValue 19 | private Integer id; 20 | private String address; //进程所在主机 21 | private String name; //进程ID 22 | private String date; //x:时间 23 | private String S0C; 24 | private String S1C; 25 | private String S0U; 26 | private String S1U; 27 | private String EC; 28 | private String EU; 29 | private String OC; 30 | private String OU; 31 | private String MC;//PC 32 | private String MU;//PU 33 | private String CCSC; 34 | private String CCSU; 35 | private String YGC; 36 | private String YGCT; 37 | private String FGC; 38 | private String FGCT; 39 | private String GCT; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/database/entity/ThreadEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.database.entity; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Entity; 6 | import javax.persistence.GeneratedValue; 7 | import javax.persistence.Id; 8 | import javax.persistence.Table; 9 | 10 | /** 11 | * Create by Martin 2018/11/12 0012 21:32 12 | */ 13 | @Data 14 | @Entity 15 | @Table(name = "thread_table") 16 | public class ThreadEntity { 17 | @Id 18 | @GeneratedValue 19 | private Integer id; 20 | private String address; //进程所在主机 21 | private String name; //进程ID 22 | private String date; //x:时间 23 | private int total; 24 | private int RUNNABLE; 25 | private int TIMED_WAITING; 26 | private int WAITING; 27 | } 28 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/database/service/ClassService.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.database.service; 2 | 3 | import com.github.onblog.server.core.entity.KVEntity; 4 | import com.github.onblog.server.database.dao.ClassLoadRespository; 5 | import com.github.onblog.server.database.entity.ClassLoadEntity; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Create by Martin 2018/11/12 0012 21:55 13 | */ 14 | @Service 15 | public class ClassService { 16 | @Autowired 17 | private ClassLoadRespository classLoadRespository; 18 | 19 | public List findAllByAddressAndName(String address, String name) { 20 | return classLoadRespository.findAllByAddressAndName(address, name); 21 | } 22 | 23 | 24 | public void write(String address, String name, String date, List jstatClass) { 25 | ClassLoadEntity entity = new ClassLoadEntity(); 26 | entity.setAddress(address); 27 | entity.setName(name); 28 | entity.setDate(date); 29 | entity.setLoaded(jstatClass.get(0).getValue()); 30 | entity.setBytes1(jstatClass.get(1).getValue()); 31 | entity.setUnloaded(jstatClass.get(2).getValue()); 32 | entity.setBytes2(jstatClass.get(3).getValue()); 33 | entity.setTime1(jstatClass.get(4).getValue()); 34 | entity.setCompiled(jstatClass.get(5).getValue()); 35 | entity.setFailed(jstatClass.get(6).getValue()); 36 | entity.setInvalid(jstatClass.get(7).getValue()); 37 | entity.setTime2(jstatClass.get(8).getValue()); 38 | classLoadRespository.save(entity); 39 | } 40 | 41 | public void clearAll() { 42 | classLoadRespository.deleteAll(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/database/service/GcService.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.database.service; 2 | 3 | import com.github.onblog.server.core.entity.KVEntity; 4 | import com.github.onblog.server.database.dao.GcRespository; 5 | import com.github.onblog.server.database.entity.GcEntity; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Create by Martin 2018/11/12 0012 21:54 13 | */ 14 | @Service 15 | public class GcService { 16 | @Autowired 17 | private GcRespository gcRespository; 18 | 19 | public void write(String address, String name, String date, List kvEntities) { 20 | GcEntity entity = new GcEntity(); 21 | entity.setAddress(address); 22 | entity.setName(name); 23 | entity.setDate(date); 24 | entity.setS0C(kvEntities.get(0).getValue()); 25 | entity.setS1C(kvEntities.get(1).getValue()); 26 | entity.setS0U(kvEntities.get(2).getValue()); 27 | entity.setS1U(kvEntities.get(3).getValue()); 28 | entity.setEC(kvEntities.get(4).getValue()); 29 | entity.setEU(kvEntities.get(5).getValue()); 30 | entity.setOC(kvEntities.get(6).getValue()); 31 | entity.setOU(kvEntities.get(7).getValue()); 32 | entity.setMC(kvEntities.get(8).getValue()); 33 | entity.setMU(kvEntities.get(9).getValue()); 34 | entity.setCCSC(kvEntities.get(10).getValue()); 35 | entity.setCCSU(kvEntities.get(11).getValue()); 36 | entity.setYGC(kvEntities.get(12).getValue()); 37 | entity.setYGCT(kvEntities.get(13).getValue()); 38 | entity.setFGC(kvEntities.get(14).getValue()); 39 | entity.setFGCT(kvEntities.get(15).getValue()); 40 | entity.setGCT(kvEntities.get(16).getValue()); 41 | gcRespository.save(entity); 42 | } 43 | 44 | public List findAllByAddressAndName(String address, String name) { 45 | return gcRespository.findAllByAddressAndName(address, name); 46 | } 47 | 48 | public void clearAll() { 49 | gcRespository.deleteAll(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/database/service/ThreadService.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.database.service; 2 | 3 | import com.github.onblog.server.core.entity.JstackEntity; 4 | import com.github.onblog.server.database.dao.ThreadRespository; 5 | import com.github.onblog.server.database.entity.ThreadEntity; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Create by Martin 2018/11/12 0012 21:56 13 | */ 14 | @Service 15 | public class ThreadService { 16 | @Autowired 17 | private ThreadRespository threadRespository; 18 | 19 | public List findAllByAddressAndName(String address, String name) { 20 | return threadRespository.findAllByAddressAndName(address, name); 21 | } 22 | 23 | public void write(String address, String name, String date, JstackEntity jstatk) { 24 | ThreadEntity entity = new ThreadEntity(); 25 | entity.setAddress(address); 26 | entity.setName(name); 27 | entity.setDate(date); 28 | entity.setTotal(jstatk.getTotal()); 29 | entity.setRUNNABLE(jstatk.getRUNNABLE()); 30 | entity.setTIMED_WAITING(jstatk.getTIMED_WAITING()); 31 | entity.setWAITING(jstatk.getWAITING()); 32 | threadRespository.save(entity); 33 | } 34 | 35 | public void clear() { 36 | 37 | } 38 | 39 | public void clearAll() { 40 | threadRespository.deleteAll(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/remote/parm/AddressParm.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.remote.parm; 2 | 3 | import com.github.onblog.server.remote.parm.entity.Address; 4 | import lombok.Data; 5 | import org.springframework.boot.context.properties.ConfigurationProperties; 6 | import org.springframework.stereotype.Component; 7 | import org.springframework.validation.annotation.Validated; 8 | 9 | import javax.validation.constraints.NotNull; 10 | import java.util.List; 11 | 12 | /** 13 | * 远程主机的地址列表 14 | * Create by Martin 2018/12/31 0031 0:16 15 | */ 16 | @Validated 17 | @Component 18 | @ConfigurationProperties(prefix="monitor") 19 | @Data 20 | public class AddressParm { 21 | @NotNull 22 | private List
serve; 23 | 24 | } -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/remote/parm/entity/Address.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.remote.parm.entity; 2 | 3 | import com.sun.jndi.toolkit.url.Uri; 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | import java.net.MalformedURLException; 8 | 9 | /** 10 | * Create by Martin 2018/12/31 0031 12:48 11 | */ 12 | @Data 13 | public class Address implements Serializable { 14 | private String name; //用于前端展示 15 | private String address; //真实ip地址 16 | private String baseAddress; //加密ip地址 17 | 18 | /** 19 | * 默认主机名 20 | */ 21 | public String getName() { 22 | if (this.name==null||this.name.trim().isEmpty()){ 23 | try { 24 | this.name=new Uri(this.address).getHost(); 25 | } catch (MalformedURLException e) { 26 | this.name = this.address; 27 | e.printStackTrace(); 28 | } 29 | } 30 | return name; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/security/encode/MyPasswordEncoder.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.security.encode; 2 | 3 | import org.springframework.security.crypto.password.PasswordEncoder; 4 | 5 | /** 6 | * Create by Martin 2018/12/31 0031 20:22 7 | */ 8 | public class MyPasswordEncoder implements PasswordEncoder { 9 | 10 | @Override 11 | public String encode(CharSequence charSequence) { 12 | return charSequence.toString(); 13 | } 14 | 15 | @Override 16 | public boolean matches(CharSequence charSequence, String s) { 17 | return s.equals(charSequence.toString()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/security/parm/SerurityParm.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.security.parm; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | * Create by Martin 2018/12/31 0031 20:39 9 | */ 10 | @Component 11 | @ConfigurationProperties(prefix="monitor") 12 | @Data 13 | public class SerurityParm { 14 | private boolean open; 15 | private String username; 16 | private String password; 17 | } 18 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/socket/config/WebSocketConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.socket.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.messaging.simp.config.MessageBrokerRegistry; 5 | import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker; 6 | import org.springframework.web.socket.config.annotation.StompEndpointRegistry; 7 | import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer; 8 | 9 | @Configuration 10 | @EnableWebSocketMessageBroker 11 | public class WebSocketConfig implements WebSocketMessageBrokerConfigurer { 12 | 13 | @Override 14 | public void configureMessageBroker(MessageBrokerRegistry config) { 15 | config.enableSimpleBroker("/topic"); 16 | config.setApplicationDestinationPrefixes("/app"); 17 | } 18 | 19 | @Override 20 | public void registerStompEndpoints(StompEndpointRegistry registry) { 21 | registry.addEndpoint("/websocket").withSockJS(); 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/socket/controller/GreetingController.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.socket.controller; 2 | 3 | 4 | import com.github.onblog.server.database.entity.ClassLoadEntity; 5 | import com.github.onblog.server.database.entity.GcEntity; 6 | import com.github.onblog.server.database.entity.ThreadEntity; 7 | import com.github.onblog.server.database.service.ClassService; 8 | import com.github.onblog.server.database.service.GcService; 9 | import com.github.onblog.server.database.service.ThreadService; 10 | import com.github.onblog.server.view.entity.Message; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.messaging.handler.annotation.MessageMapping; 13 | import org.springframework.messaging.handler.annotation.SendTo; 14 | import org.springframework.stereotype.Controller; 15 | 16 | import java.util.List; 17 | 18 | /** 19 | * Create by Martin 2018/6/19/019 23:49 20 | */ 21 | @Controller 22 | public class GreetingController { 23 | 24 | @Autowired 25 | private GcService gcService; 26 | @Autowired 27 | private ClassService classService; 28 | @Autowired 29 | private ThreadService threadService; 30 | 31 | @MessageMapping("/gc") 32 | @SendTo("/topic/gc") 33 | public List socketGc(Message message) throws Exception { 34 | return gcService.findAllByAddressAndName(message.getAddress(),message.getPid()); 35 | } 36 | 37 | @MessageMapping("/class") 38 | @SendTo("/topic/class") 39 | public List socketClass(Message message) throws Exception { 40 | return classService.findAllByAddressAndName(message.getAddress(),message.getPid()); 41 | } 42 | 43 | @MessageMapping("/thread") 44 | @SendTo("/topic/thread") 45 | public List socketThread(Message message) throws Exception { 46 | return threadService.findAllByAddressAndName(message.getAddress(),message.getPid()); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/timer/job/ClearJob.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.timer.job; 2 | 3 | 4 | import com.github.onblog.server.database.service.ClassService; 5 | import com.github.onblog.server.database.service.GcService; 6 | import com.github.onblog.server.database.service.ThreadService; 7 | import org.quartz.JobExecutionContext; 8 | import org.quartz.JobExecutionException; 9 | import org.slf4j.Logger; 10 | import org.slf4j.LoggerFactory; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.scheduling.quartz.QuartzJobBean; 13 | 14 | /** 15 | * Create by Martin 2018/11/14 0014 21:01 16 | */ 17 | public class ClearJob extends QuartzJobBean { 18 | private Logger logger = LoggerFactory.getLogger(getClass().getName()); 19 | 20 | @Autowired 21 | private GcService gcService; 22 | @Autowired 23 | private ClassService classService; 24 | @Autowired 25 | private ThreadService threadService; 26 | 27 | @Override 28 | protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException { 29 | logger.warn("Clear all data on a regular basis"); 30 | gcService.clearAll(); 31 | classService.clearAll(); 32 | threadService.clearAll(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/timer/parm/CronParm.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.timer.parm; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | * Create by Martin 2018/11/14 0014 21:18 9 | */ 10 | @Component 11 | @ConfigurationProperties(prefix="monitor") 12 | @Data 13 | public class CronParm { 14 | private String cron; 15 | private Integer rate; 16 | } 17 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/timer/util/TimerUtil.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.timer.util; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | /** 7 | * Create by Martin 2018/11/14 0014 21:02 8 | */ 9 | public class TimerUtil { 10 | /** 11 | * 现在时间 12 | * @return 13 | */ 14 | public static String now(){ 15 | SimpleDateFormat format = new SimpleDateFormat("MM/dd HH:mm"); 16 | return format.format(new Date()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/view/ViewController.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.view; 2 | 3 | 4 | import com.github.onblog.server.remote.parm.AddressParm; 5 | import com.github.onblog.server.remote.parm.entity.Address; 6 | import com.github.onblog.server.view.service.ViewService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.ui.ModelMap; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | 12 | import java.io.IOException; 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | import java.util.Map; 16 | 17 | /** 18 | * Create by Martin 2018/11/12 0012 23:29 19 | */ 20 | @Controller 21 | public class ViewController { 22 | @Autowired 23 | private AddressParm addressParm; 24 | @Autowired 25 | private ViewService viewService; 26 | 27 | @RequestMapping(value = "/") 28 | public String index(ModelMap model) throws IOException { 29 | List> list = new ArrayList<>(); 30 | for (Address address : addressParm.getServe()) { 31 | list.add(viewService.getIndex(address)); 32 | } 33 | model.addAttribute("list",list); 34 | return "index"; 35 | } 36 | 37 | @RequestMapping(value = "/main") 38 | public String main(ModelMap model) throws IOException { 39 | List list = new ArrayList<>(); 40 | for (Address address : addressParm.getServe()) { 41 | list.add(viewService.getMain(address)); 42 | } 43 | model.addAttribute("list",list); 44 | return "main"; 45 | } 46 | 47 | @RequestMapping(value = "/monitor") 48 | public String monitor(){ 49 | return "monitor"; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/view/entity/Message.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.view.entity; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | /** 7 | * Create by Martin 2018/12/31 0031 15:52 8 | */ 9 | public class Message { 10 | @Setter @Getter 11 | private String address; 12 | @Setter @Getter 13 | private String pid; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/java/com/github/onblog/server/view/service/ViewService.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server.view.service; 2 | 3 | import com.github.onblog.server.remote.CallingMethod; 4 | import com.github.onblog.server.remote.parm.entity.Address; 5 | import com.alibaba.fastjson.JSON; 6 | import org.springframework.cache.annotation.CacheConfig; 7 | import org.springframework.cache.annotation.Cacheable; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.io.IOException; 11 | import java.util.HashMap; 12 | import java.util.Map; 13 | 14 | /** 15 | * Create by Martin 2018/12/31 0031 22:25 16 | */ 17 | @Service 18 | @CacheConfig(cacheNames = {"myCache"}) 19 | public class ViewService { 20 | 21 | @Cacheable(key ="targetClass + methodName +#p0") 22 | public Map getIndex(Address address) throws IOException { 23 | Map map = new HashMap<>(); 24 | map.put("address",address); 25 | map.put("jps", CallingMethod.getJps(address.getAddress())); 26 | return map; 27 | } 28 | 29 | @Cacheable(key ="targetClass + methodName +#p0") 30 | public Map getMain(Address address) throws IOException { 31 | Map map = new HashMap<>(); 32 | map.put("jps",CallingMethod.getJps(address.getAddress())); 33 | map.put("system", JSON.parseObject(CallingMethod.getSystem(address.getAddress()),Map.class)); 34 | map.put("version",CallingMethod.getVersion(address.getAddress())); 35 | map.put("address",address); 36 | return map; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8888 2 | spring.datasource.driver-class-name=org.h2.Driver 3 | spring.datasource.url=jdbc:h2:~/JMPDataBase/monitor 4 | spring.datasource.username=root 5 | spring.datasource.password=123456 6 | spring.jpa.show-sql=false 7 | spring.jpa.hibernate.ddl-auto=create 8 | spring.cache.type=ehcache 9 | #\u76D1\u63A7\u9891\u7387\u4E0E\u5468\u671F 10 | monitor.rate=60 11 | monitor.cron=0 0 0 * * ? 12 | #name\u4E0D\u662F\u5FC5\u987B\u7684\uFF0C\u5FC5\u987B\u58F0\u660EHTTP\u534F\u8BAE 13 | #monitor.serve[0].name=serve-1 14 | #monitor.serve[0].address=http://127.0.0.1:8081 15 | #\u5B89\u5168\u8BA4\u8BC1\uFF08\u9ED8\u8BA4\u4E0D\u5F00\u542F\uFF09 16 | #monitor.open=false 17 | #monitor.username=admin 18 | #monitor.password=admin 19 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/ehcache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 27 | 29 | 30 | 32 | 33 | -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/ico/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/ico/favicon.ico -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/js/ccsc.js: -------------------------------------------------------------------------------- 1 | function ccsc(data) { 2 | var myChart = echarts.init(document.getElementById('ccsc'));//(1) 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/KB', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: white 36 | } 37 | }], 38 | series: [ 39 | { 40 | name: "CCSC",//(2) 41 | type: 'line', 42 | data: data.map(function (item) { 43 | return item.ccsc; 44 | }), 45 | lineStyle: { 46 | color: colors[0] 47 | } 48 | }, 49 | { 50 | name: "CCSU",//(3) 51 | type: 'line', 52 | data: data.map(function (item) { 53 | return item.ccsu 54 | }), 55 | lineStyle: { 56 | color: colors[1] 57 | } 58 | }] 59 | }); 60 | } -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/js/classt.js: -------------------------------------------------------------------------------- 1 | function classt(data) { 2 | var myChart = echarts.init(document.getElementById('classt'));//(1) 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/秒', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: [colors[0]] 36 | } 37 | }], 38 | series: [ 39 | { 40 | name: "Time",//(2) 41 | type: 'line', 42 | data: data.map(function (item) { 43 | return item.time1; 44 | }), 45 | lineStyle: { 46 | color: colors[0] 47 | } 48 | }] 49 | }); 50 | } -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/js/combyte.js: -------------------------------------------------------------------------------- 1 | function combyte(data) { 2 | var myChart = echarts.init(document.getElementById('combyte'));//(1) 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/KB', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: white, 36 | symbolSize: [0, 5] 37 | } 38 | }], 39 | series: [ 40 | { 41 | name: "Loaded",//(2) 42 | type: 'line', 43 | data: data.map(function (item) { 44 | return item.bytes1; 45 | }), 46 | lineStyle: { 47 | color: colors[0] 48 | } 49 | }, 50 | { 51 | name: "Unloaded",//(3) 52 | type: 'line', 53 | data: data.map(function (item) { 54 | return item.bytes2 55 | }), 56 | lineStyle: { 57 | color: colors[1] 58 | } 59 | }] 60 | }); 61 | } -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/js/comt.js: -------------------------------------------------------------------------------- 1 | function comt(data) { 2 | var myChart = echarts.init(document.getElementById('comt'));//(1) 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/秒', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: [colors[0]] 36 | } 37 | }], 38 | series: [ 39 | { 40 | name: "Time",//(2) 41 | type: 'line', 42 | data: data.map(function (item) { 43 | return item.time2; 44 | }), 45 | lineStyle: { 46 | color: colors[0] 47 | } 48 | }] 49 | }); 50 | } -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/js/eden.js: -------------------------------------------------------------------------------- 1 | function eden(data) { 2 | var myChart = echarts.init(document.getElementById('eden')); 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/KB', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: white 36 | } 37 | }], 38 | series: [ 39 | { 40 | name: "EC", 41 | type: 'line', 42 | data: data.map(function (item) { 43 | return item.ec; 44 | }), 45 | lineStyle: { 46 | color: colors[0] 47 | } 48 | }, 49 | { 50 | name: "EU", 51 | type: 'line', 52 | data: data.map(function (item) { 53 | return item.eu; 54 | }), 55 | lineStyle: { 56 | color: colors[1] 57 | } 58 | }] 59 | }); 60 | } -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/js/gcn.js: -------------------------------------------------------------------------------- 1 | function gcn(data) { 2 | var myChart = echarts.init(document.getElementById('gcn'));//(1) 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/次', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: white 36 | } 37 | }], 38 | series: [ 39 | { 40 | name: "YGC",//(2) 41 | type: 'line', 42 | data: data.map(function (item) { 43 | return item.ygc; 44 | }), 45 | lineStyle: { 46 | color: colors[0] 47 | } 48 | }, 49 | { 50 | name: "FGC",//(3) 51 | type: 'line', 52 | data: data.map(function (item) { 53 | return item.fgc 54 | }), 55 | lineStyle: { 56 | color: colors[1] 57 | } 58 | }] 59 | }); 60 | } -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/js/mc.js: -------------------------------------------------------------------------------- 1 | function mc(data) { 2 | var myChart = echarts.init(document.getElementById('mc')); 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/KB', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: white 36 | } 37 | }], 38 | series: [ 39 | { 40 | name: "MC", 41 | type: 'line', 42 | data: data.map(function (item) { 43 | return item.mc; 44 | }), 45 | lineStyle: { 46 | color: colors[0] 47 | } 48 | }, 49 | { 50 | name: "MU", 51 | type: 'line', 52 | data: data.map(function (item) { 53 | return item.mu; 54 | }), 55 | lineStyle: { 56 | color: colors[1] 57 | } 58 | }] 59 | }); 60 | } -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/js/old.js: -------------------------------------------------------------------------------- 1 | function old(data) { 2 | var myChart = echarts.init(document.getElementById('old')); 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/KB', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: white 36 | } 37 | }], 38 | series: [ 39 | { 40 | name: "OC", 41 | type: 'line', 42 | data: data.map(function (item) { 43 | return item.oc; 44 | }), 45 | lineStyle: { 46 | color: colors[0] 47 | } 48 | }, 49 | { 50 | name: "OU", 51 | type: 'line', 52 | data: data.map(function (item) { 53 | return item.ou; 54 | }), 55 | lineStyle: { 56 | color: colors[1] 57 | } 58 | }] 59 | }); 60 | } -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/js/s0.js: -------------------------------------------------------------------------------- 1 | function s0(data) { 2 | var myChart = echarts.init(document.getElementById('s0')); 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/KB', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: white 36 | } 37 | }], 38 | series: [ 39 | { 40 | name: "SOC", 41 | type: 'line', 42 | data: data.map(function (item) { 43 | return item.s0C; 44 | }), 45 | lineStyle: { 46 | color: colors[0] 47 | } 48 | }, 49 | { 50 | name: "SOU", 51 | type: 'line', 52 | data: data.map(function (item) { 53 | return item.s0U; 54 | }), 55 | lineStyle: { 56 | color: colors[1] 57 | } 58 | }] 59 | }); 60 | } -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/js/s1.js: -------------------------------------------------------------------------------- 1 | function s1(data) { 2 | var myChart = echarts.init(document.getElementById('s1')); 3 | myChart.setOption(option = { 4 | backgroundColor: background_color, 5 | title: { 6 | subtext: '单位/KB', 7 | textStyle: { 8 | color: '#fff' 9 | } 10 | }, 11 | xAxis: { 12 | axisLine: { lineStyle: { color: '#8392A5' } }, 13 | data: data.map(function (item) { 14 | return item.date; 15 | }), 16 | nameTextStyle: { 17 | color: '#fff' 18 | } 19 | }, 20 | yAxis: { 21 | scale: true, 22 | axisLine: { lineStyle: { color: '#8392A5' } }, 23 | splitLine: { show: false } 24 | }, 25 | tooltip: my_tooltip, 26 | toolbox: my_toolbox, 27 | dataZoom: [{ 28 | startValue: data[0].date 29 | }, { 30 | type: 'inside' 31 | }], 32 | visualMap: [{ 33 | show: false, 34 | inRange: { 35 | color: white 36 | } 37 | }], 38 | series: [ 39 | { 40 | name: "S1C", 41 | type: 'line', 42 | data: data.map(function (item) { 43 | return item.s1C; 44 | }), 45 | lineStyle: { 46 | color: colors[0] 47 | } 48 | }, 49 | { 50 | name: "S1U", 51 | type: 'line', 52 | data: data.map(function (item) { 53 | return item.s1U; 54 | }), 55 | lineStyle: { 56 | color: colors[1] 57 | } 58 | }] 59 | }); 60 | } -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/js/util.js: -------------------------------------------------------------------------------- 1 | //获取URL参数 2 | function GetQueryString(name) { 3 | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); 4 | var r = window.location.search.substr(1).match(reg); 5 | if (r != null) return decodeURI(r[2]); 6 | return null; 7 | } 8 | 9 | //折线颜色 10 | var colors = ['#cc0033', '#ff5722', '#2196f3', '#4caf50']; 11 | //点 12 | var white = null; 13 | //背景色 14 | var background_color = '#21202D'; 15 | 16 | var my_tooltip = { 17 | trigger: 'axis', 18 | axisPointer: { 19 | animation: false, 20 | type: 'cross', 21 | lineStyle: { 22 | color: '#376df4', 23 | width: 2, 24 | opacity: 1 25 | } 26 | } 27 | }; 28 | var my_toolbox ={ 29 | left: 'center', 30 | feature: { 31 | dataZoom: { 32 | yAxisIndex: 'none' 33 | }, 34 | restore: {}, 35 | saveAsImage: {}, 36 | magicType: { 37 | type: [] 38 | } 39 | } 40 | }; 41 | //下载快照 42 | $("#heap_button").click(function () { 43 | window.open(address+"/heap?id="+pid); 44 | }); 45 | $("#thread_button").click(function () { 46 | window.open(address+"/thread?id="+pid); 47 | }); -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/css/modules/code.css: -------------------------------------------------------------------------------- 1 | /** layui-v2.4.3 MIT License By https://www.layui.com */ 2 | html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none} -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/css/modules/layer/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/css/modules/layer/default/icon-ext.png -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/css/modules/layer/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/css/modules/layer/default/icon.png -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/css/modules/layer/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/css/modules/layer/default/loading-0.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/css/modules/layer/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/css/modules/layer/default/loading-1.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/css/modules/layer/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/css/modules/layer/default/loading-2.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/font/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/font/iconfont.eot -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/font/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/font/iconfont.ttf -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/font/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/font/iconfont.woff -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/0.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/1.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/10.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/10.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/11.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/11.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/12.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/12.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/13.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/13.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/14.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/14.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/15.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/15.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/16.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/17.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/17.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/18.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/18.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/19.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/19.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/2.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/20.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/20.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/21.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/21.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/22.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/22.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/23.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/23.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/24.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/25.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/25.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/26.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/26.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/27.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/27.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/28.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/28.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/29.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/29.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/3.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/30.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/30.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/31.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/31.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/32.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/32.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/33.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/33.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/34.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/34.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/35.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/35.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/36.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/36.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/37.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/37.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/38.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/38.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/39.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/39.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/4.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/40.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/40.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/41.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/41.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/42.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/42.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/43.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/43.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/44.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/44.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/45.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/45.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/46.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/46.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/47.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/47.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/48.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/48.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/49.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/49.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/5.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/50.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/50.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/51.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/51.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/52.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/52.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/53.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/53.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/54.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/54.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/55.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/55.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/56.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/56.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/57.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/57.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/58.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/58.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/59.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/59.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/6.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/60.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/60.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/61.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/61.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/62.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/62.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/63.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/63.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/64.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/64.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/65.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/65.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/66.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/66.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/67.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/67.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/68.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/68.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/69.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/69.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/7.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/70.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/70.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/71.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/71.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/8.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onblog/JavaMonitor/5bf6ef7ad1979f0ce57925cb0ac27362ba7dcdab/JavaMonitorPlus/server/src/main/resources/static/lib/layui/images/face/9.gif -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/lay/modules/code.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.4.3 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var a=layui.$,l="http://www.layui.com/doc/modules/code.html";e("code",function(e){var t=[];e=e||{},e.elem=a(e.elem||".layui-code"),e.about=!("about"in e)||e.about,e.elem.each(function(){t.push(this)}),layui.each(t.reverse(),function(t,i){var c=a(i),o=c.html();(c.attr("lay-encode")||e.encode)&&(o=o.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")),c.html('
  1. '+o.replace(/[\r\t\n]+/g,"
  2. ")+"
"),c.find(">.layui-code-h3")[0]||c.prepend('

'+(c.attr("lay-title")||e.title||"code")+(e.about?'layui.code':"")+"

");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss"); -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/lay/modules/flow.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.4.3 MIT License By https://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="加载更多",h=l('");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;su)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)}); -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/main/resources/static/lib/layui/lay/modules/laytpl.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.4.3 MIT License By https://www.layui.com */ 2 | ;layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)}); -------------------------------------------------------------------------------- /JavaMonitorPlus/server/src/test/java/com/github/onblog/server/ServerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.github.onblog.server; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class ServerApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | 18 | --------------------------------------------------------------------------------