TestRunner.java 3.61 KB
package se.lil.jm;

import java.util.ArrayList;

public class TestRunner {

	public TestRunner() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) throws Throwable{
		// TODO Auto-generated method stub
		
		//ArrayList<OraMon> oraList = new ArrayList<OraMon>();
		ArrayList<JmxMon> jmxList = Registry.getList();
		
		Long ts1 = System.currentTimeMillis();
		
		//JmxMon mon1 = new JmxMon("service:jmx:iiop:///jndi/iiop://u30457:29722/weblogic.management.mbeanservers.runtime"); // 10.3.6.0.161018.2
		//JmxMon mon1 = new JmxMon("service:jmx:rmi:///jndi/iiop://u30128:23032/weblogic.management.mbeanservers.runtime"); // 10.3.6.0.161018.2
		JmxMon mon1 = new JmxMon("service:jmx:rmi:///jndi/iiop://u30009:26732/weblogic.management.mbeanservers.runtime"); // 10.3.6.0.12.1
		//JmxMon mon1 = new JmxMon("service:jmx:rmi:///jndi/iiop://u30009:2673/weblogic.management.mbeanservers.runtime"); // Fel port
		//JmxMon mon1 = new JmxMon("service:jmx:rmi:///jndi/iiop://u02878.ht.kap.rsv.se:17040/weblogic.management.mbeanservers.runtime"); // 10.3.6.0.161018.2 PS
		//JmxMon mon1 = new JmxMon("service:jmx:rmi:///jndi/iiop://u01891.ef.kap.rsv.se:17020/weblogic.management.mbeanservers.runtime"); // 10.3.6.0.161018.2 CMS
		//JmxMon mon1 = new JmxMon("service:jmx:rmi:///jndi/iiop://u30450:34502/weblogic.management.mbeanservers.runtime"); // CMS
		mon1.open();
		//mon2.open();
		jmxList.add(mon1);
		//jmxList.add(mon2);
				
		Long time = System.currentTimeMillis() - ts1;
		
		System.out.println(
				"Open called on all jmx monitors"
				+ "\nTime: " + time + "ms\n"
				);
		
		int times = 10;
		while(times-- > 0) {
			for(JmxMon mon : jmxList) {
				ts1 = System.currentTimeMillis();
				mon.getData();
				time = System.currentTimeMillis() - ts1;
				System.out.println(mon.getServerName() + " called in " + time + "ms");
				System.out.println("       Number of processors #: " + mon.getNumberOfCPUs());
				System.out.println("           Process CPU Used %: " + mon.getCPUPercent());
				System.out.println("            Process Threads #: " + mon.getThreads());
				System.out.println("     Process Loaded Classes #: " + mon.getLoadedClassCount());
				System.out.println("   Process File Descriptors %: " + mon.getSystemFileDescriptorsPercentUsed());
				System.out.println("    Process Heap Committed MB: " + mon.getHeapCommittedMB());
				System.out.println("         Process Heap Used MB: " + mon.getHeapUsedMB());
				System.out.println("          Process Heap Used %: " + mon.getHeapUsedPercent());
				System.out.println("               OldGen Used MB: " + mon.getOldGenUsedMB());
				System.out.println("                OldGen Used %: " + mon.getOldGenUsedPercent());
				System.out.println("      OldGen After Last GC MB: " + mon.getOldGenAfterGCMB());
				System.out.println("     PermGen After Last GC MB: " + mon.getPermGenAfterGCMB());
				System.out.println("         GC Time (Overhead) %: " + mon.getGCOverhead());
				System.out.println("        System Load (per cpu): " + mon.getAverageLoadPerCpu());
				System.out.println("          System Load (total): " + mon.getAverageLoad());
				System.out.println("              System Memory %: " + mon.getSystemMemoryPercentUsed());
				System.out.println("                System Swap %: " + mon.getSystemSwapPercentUsed());
				
				System.out.println();
				
				//mon.dumpDeltas();
			}
			Thread.sleep(15000);
		}
		
		// Close all mon objects
		for(JmxMon mon : jmxList) {
			mon.close();
			System.out.println("Monitor closed. " + mon.getDataCalled() + " calls and " + mon.getDataSucceeded() + " succeeded and " + mon.getDataFailed() + " failed.");
		}
		
	}
}