Bläddra i källkod

虚拟机监控 添加展示参数信息

user5 2 år sedan
förälder
incheckning
4ae76791c0

+ 10 - 0
jeeplus-plugins/jeeplus-monitor/src/main/java/com/jeeplus/quartz/server/ServerOS.java

@@ -1,6 +1,7 @@
 package com.jeeplus.quartz.server;
 
 import com.google.common.collect.Lists;
+import com.jeeplus.quartz.utils.DateUtils;
 import com.jeeplus.quartz.utils.MathUtils;
 import com.jeeplus.quartz.utils.IpUtils;
 import oshi.SystemInfo;
@@ -12,6 +13,7 @@ import oshi.software.os.OSFileStore;
 import oshi.software.os.OperatingSystem;
 import oshi.util.Util;
 
+import java.lang.management.ManagementFactory;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -134,6 +136,14 @@ public class ServerOS {
         jvm.put("maxTotal",div(Runtime.getRuntime().maxMemory(),1024*1024,2));
         jvm.put("usedMem", div((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()),1024*1024,2));
         jvm.put("used", MathUtils.round(MathUtils.mul((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())*1.0/ Runtime.getRuntime().totalMemory(), 100), 2));
+
+        //JDK启动时间
+        jvm.put("startTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.getServerStartDate()));
+        //JDK运行时间
+        jvm.put("runTime", DateUtils.getDatePoor(DateUtils.getNowDate(), DateUtils.getServerStartDate()));
+        //运行参数
+        jvm.put("inputArg", ManagementFactory.getRuntimeMXBean().getInputArguments().toString());
+
         return jvm;
     }