IDEMPIERE-4072 iDempiere Monitor: Implement server and cache details for cluster node. Show propertyFileName, Average GC time and host name.

This commit is contained in:
Heng Sin Low 2019-10-27 19:53:43 +08:00
parent 45bc22b734
commit ad1eb20e20
2 changed files with 41 additions and 34 deletions

View File

@ -37,11 +37,13 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.logging.Level; import java.util.logging.Level;
import org.compiere.Adempiere;
import org.compiere.db.AdempiereDatabase; import org.compiere.db.AdempiereDatabase;
import org.compiere.db.CConnection; import org.compiere.db.CConnection;
import org.compiere.model.MSession; import org.compiere.model.MSession;
import org.compiere.util.CLogMgt; import org.compiere.util.CLogMgt;
import org.compiere.util.CMemoryUsage; import org.compiere.util.CMemoryUsage;
import org.compiere.util.Ini;
import org.idempiere.distributed.IClusterMember; import org.idempiere.distributed.IClusterMember;
import org.idempiere.distributed.IClusterService; import org.idempiere.distributed.IClusterService;
import org.idempiere.server.cluster.ClusterServerMgr; import org.idempiere.server.cluster.ClusterServerMgr;
@ -58,6 +60,8 @@ public class SystemInfo implements Serializable {
*/ */
private static final long serialVersionUID = -4451616690416295597L; private static final long serialVersionUID = -4451616690416295597L;
private String propertyFileName;
private String idempereHome;
private String operatingSystem; private String operatingSystem;
private String javaVM; private String javaVM;
private String databaseDescription; private String databaseDescription;
@ -90,6 +94,22 @@ public class SystemInfo implements Serializable {
private SystemInfo() { private SystemInfo() {
} }
/**
*
* @return idempiere property filename
*/
public String getPropertyFileName() {
return propertyFileName;
}
/**
*
* @return idempiere home
*/
public String getIDempiereHome() {
return idempereHome;
}
/** /**
* @return the operatingSystem * @return the operatingSystem
*/ */
@ -218,6 +238,8 @@ public class SystemInfo implements Serializable {
public static SystemInfo getLocalSystemInfo() { public static SystemInfo getLocalSystemInfo() {
SystemInfo si = new SystemInfo(); SystemInfo si = new SystemInfo();
si.propertyFileName = Ini.getPropertyFileName();
si.idempereHome = Adempiere.getAdempiereHome();
OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean(); OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean();
String osInfo = os.getName() + " " + os.getVersion(); String osInfo = os.getName() + " " + os.getVersion();
osInfo += " (" + os.getArch() + ")"; osInfo += " (" + os.getArch() + ")";
@ -259,13 +281,6 @@ public class SystemInfo implements Serializable {
return si; return si;
} }
/**
* @return the serialversionuid
*/
public static long getSerialversionuid() {
return serialVersionUID;
}
/** /**
* @return the garbageCollectionCount * @return the garbageCollectionCount
*/ */

View File

@ -707,13 +707,9 @@ public class AdempiereMonitor extends HttpServlet
p para = new p(); p para = new p();
StringBuilder nodeBuilder = new StringBuilder(local.getId()); StringBuilder nodeBuilder = new StringBuilder(local.getId());
InetAddress address = local.getAddress(); InetAddress address = local.getAddress();
String ip = address != null ? address.getHostAddress() : null; if (address != null)
if (ip != null &&
(ip.startsWith("10.") ||
ip.startsWith("172.16") ||
ip.startsWith("192.168")))
{ {
nodeBuilder.append(" (").append(ip).append(")"); nodeBuilder.append(" (").append(address.getCanonicalHostName()).append(")");
} }
para.addElement(nodeBuilder.toString()); para.addElement(nodeBuilder.toString());
@ -728,13 +724,9 @@ public class AdempiereMonitor extends HttpServlet
para.addElement(" - "); para.addElement(" - ");
nodeBuilder = new StringBuilder(member.getId()); nodeBuilder = new StringBuilder(member.getId());
address = member.getAddress(); address = member.getAddress();
ip = address != null ? address.getHostAddress() : null; if (address != null)
if (ip != null &&
(ip.startsWith("10.") ||
ip.startsWith("172.16") ||
ip.startsWith("192.168")))
{ {
nodeBuilder.append(" (").append(ip).append(")"); nodeBuilder.append(" (").append(address.getCanonicalHostName()).append(")");
} }
a link = new a ("idempiereMonitor?NodeInfo="+member.getId(), nodeBuilder.toString()); a link = new a ("idempiereMonitor?NodeInfo="+member.getId(), nodeBuilder.toString());
para.addElement(link); para.addElement(link);
@ -1028,7 +1020,7 @@ public class AdempiereMonitor extends HttpServlet
SystemInfo systemInfo = SystemInfo.getLocalSystemInfo(); SystemInfo systemInfo = SystemInfo.getLocalSystemInfo();
tr line = new tr(); tr line = new tr();
line.addElement(new th().addElement(Adempiere.getURL())); line.addElement(new th().addElement(Adempiere.getURL()));
line.addElement(new td().addElement(Adempiere.getAdempiereHome())); line.addElement(new td().addElement(systemInfo.getPropertyFileName()));
table.addElement(line); table.addElement(line);
// OS + Name // OS + Name
line = new tr(); line = new tr();
@ -1041,7 +1033,7 @@ public class AdempiereMonitor extends HttpServlet
// Java + email // Java + email
line = new tr(); line = new tr();
line.addElement(new th().addElement(systemInfo.getJavaVM())); line.addElement(new th().addElement(systemInfo.getJavaVM()));
line.addElement(new td().addElement(system.getSupportEMail())); line.addElement(new td().addElement("Average GC Time=" + systemInfo.getGarbageCollectionTime() / systemInfo.getGarbageCollectionCount() + " ms"));
table.addElement(line); table.addElement(line);
// DB + Instance // DB + Instance
line = new tr(); line = new tr();
@ -1533,26 +1525,26 @@ public class AdempiereMonitor extends HttpServlet
table.setCellSpacing(2); table.setCellSpacing(2);
table.setCellPadding(2); table.setCellPadding(2);
tr line = new tr();
line.addElement(new th().addElement("Property File"));
line.addElement(new td().addElement(systemInfo.getPropertyFileName()));
table.addElement(line);
line = new tr();
InetAddress address = systemInfo.getAddress(); InetAddress address = systemInfo.getAddress();
String ip = address != null ? address.getHostAddress() : null; line.addElement(new th().addElement("Host Name"));
if (ip != null && line.addElement(new td().addElement(address.getCanonicalHostName()));
(ip.startsWith("10.") || table.addElement(line);
ip.startsWith("172.16") ||
ip.startsWith("192.168")))
{
tr line = new tr();
line.addElement(new th().addElement("IP Address"));
line.addElement(new td().addElement(ip));
table.addElement(line);
}
// OS + Name // OS + Name
tr line = new tr(); line = new tr();
line.addElement(new th().addElement(systemInfo.getOperatingSystem())); line.addElement(new th().addElement("Operating System"));
line.addElement(new td().addElement(systemInfo.getOperatingSystem()));
table.addElement(line); table.addElement(line);
// Java + email // Java + email
line = new tr(); line = new tr();
line.addElement(new th().addElement(systemInfo.getJavaVM())); line.addElement(new th().addElement(systemInfo.getJavaVM()));
line.addElement(new td().addElement("Average GC Time=" + systemInfo.getGarbageCollectionTime() / systemInfo.getGarbageCollectionCount() + " ms"));
table.addElement(line); table.addElement(line);
// DB + Instance // DB + Instance
line = new tr(); line = new tr();