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

View File

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