Commit 11bc5265 11bc5265810319be9eee9db2bb97a6c55413595c by Christian Gerdes

JMX clienter och lite annat i lib, fungerande runner

JMX clienterna finns för 2 olika wls versioner fast dessa inte behövs
1 parent 92dffe6c
No preview for this file type
javaw.exe -Dcom.sun.management.jmxremote.ssl=false -cp "wls-10.3.6.0.161018.2/wljmxclient.jar;jconsole.1.8.0_91.jar" sun.tools.jconsole.JConsole "service:jmx:rmi:///jndi/iiop://u30128:23032/weblogic.management.mbeanservers.runtime"
\ No newline at end of file
javaw.exe -Dcom.sun.management.jmxremote.ssl=false -cp "wls-10.3.6.0.12.1/wljmxclient.jar;jconsole.1.8.0_91.jar" sun.tools.jconsole.JConsole "service:jmx:rmi:///jndi/iiop://u30009:26732/weblogic.management.mbeanservers.runtime"
\ No newline at end of file
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -16,42 +16,37 @@ import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
import javax.management.openmbean.CompositeData;
import javax.management.openmbean.TabularData;
public class JmxMon {
String conUser = "system";
String conPass = "passw0rd";
String domain = null;
String domainName = null;
String serverName = null;
String runtimeName = null;
JMXServiceURL url = null;
JMXConnector jmxc = null;
MBeanServerConnection mbsc = null;
Thread myThread = null;
ClassLoader myCL = null;
Collector col = new Collector();
int getDataCalls = 0;
int getDataSucess = 0;
public void dumpAllMBeans() {
dumpAllMBeans(null);
}
public void dumpAllMBeans(String query) {
public Object getAttributeValue(String name, String attribute) {
Object ro = null;
if(mbsc != null) {
try {
Set<ObjectName> res = mbsc.queryNames(query != null ? new ObjectName(query) : ObjectName.WILDCARD, null);
for (ObjectName name : res) {
System.out.println(name.getCanonicalName());
MBeanInfo inf = mbsc.getMBeanInfo(name);
MBeanAttributeInfo[] attribs = inf.getAttributes();
for (MBeanAttributeInfo ainf : attribs) {
System.out.println("(" + ainf.getType() + ") " + ainf.getName());
}
}
ro = mbsc.getAttribute(new ObjectName(name), attribute);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
ro = e;
}
}
return ro;
}
public int getDataCalled() {
......@@ -71,11 +66,33 @@ public class JmxMon {
else return null;
}
public String getServerName() {
return serverName;
}
public String getDomainName() {
return domainName;
}
public String getRuntimeName() {
return runtimeName;
}
public void open() throws IOException {
if(url != null) {
jmxc = JMXConnectorFactory.connect(url);
mbsc = jmxc.getMBeanServerConnection();
domain = mbsc.getDefaultDomain();
domainName = mbsc.getDefaultDomain();
Object obj = getAttributeValue("java.lang:type=Runtime", "Name");
if(obj.getClass().equals(java.lang.String.class)) {
runtimeName = (String)obj;
}
obj = getAttributeValue("java.lang:type=Runtime", "SystemProperties");
TabularData td = (TabularData)obj;
for (Object o : td.values()) {
CompositeData d = (CompositeData)o;
if(d.get("key").toString().equals("weblogic.Name")) serverName = d.get("value").toString();
}
}
}
......
......@@ -19,8 +19,8 @@ public class TestRunner {
Long ts1 = System.currentTimeMillis();
//JmxMon mon1 = new JmxMon("service:jmx:rmi:///jndi/iiop://u01892.ef.kap.rsv.se:17020/weblogic.management.mbeanservers.runtime");
JmxMon mon1 = new JmxMon("service:jmx:iiop:///jndi/iiop://u30009:26732/weblogic.management.mbeanservers.runtime");
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
mon1.open();
jmxList.add(mon1);
......@@ -31,8 +31,11 @@ public class TestRunner {
+ "\nTime: " + time + "ms\n"
);
mon1.dumpAllMBeans("java.lang:*");
System.out.println("Connected to server " + mon1.getServerName() + " on domain " + mon1.getDomainName() + " and machine " + mon1.getRuntimeName());
//mon1.listAllMBeans();
//mon1.dumpAllMBeans("java.lang:*");
/*
int times = 0;
while(times-- > 0) {
for(JmxMon mon : jmxList) {
......@@ -41,11 +44,6 @@ public class TestRunner {
mon.getData();
time = System.currentTimeMillis() - ts1;
System.out.println(
"GetData called on " + mon.domain + " (age was " + age + "s)"
+ "\nTime: " + time + "ms\n\n"
);
}
Thread.sleep(15000);
}
......@@ -55,5 +53,6 @@ public class TestRunner {
mon.close();
System.out.println("Monitor closed. " + mon.getDataCalled() + " calls and " + mon.getDataSucceeded() + " succeeded and " + mon.getDataFailed() + " failed.");
}
*/
}
}
......