jmx test
This commit is contained in:
parent
bf7ee36cef
commit
87bd965376
|
@ -53,12 +53,19 @@ public class JmxCrawler extends Crawler{
|
||||||
logCrawler(mbeanName, attr, "not readable");
|
logCrawler(mbeanName, attr, "not readable");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// System.out.println("========================================================================");
|
||||||
|
// System.out.println("PropertyListString"+mbeanName.getCanonicalKeyPropertyListString());
|
||||||
|
// System.out.println("canonicaName="+mbeanName.getCanonicalName());
|
||||||
|
// System.out.println(mbeanName.getDomain());
|
||||||
|
// System.out.println(mbeanName.getKeyPropertyListString().compareTo("http"));
|
||||||
|
// System.out.println("========================================================================");
|
||||||
Object att = null;
|
Object att = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
att = beanCon.getAttribute(mbeanName, attr.getName());
|
att = beanCon.getAttribute(mbeanName, attr.getName());
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
e.printStackTrace();
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (att != null)
|
if (att != null)
|
||||||
|
@ -74,8 +81,8 @@ public class JmxCrawler extends Crawler{
|
||||||
String port = config.getTarget().getConnection().getPort();
|
String port = config.getTarget().getConnection().getPort();
|
||||||
|
|
||||||
this.jmxUrl = "service:jmx:rmi:///jndi/rmi://" + hostIp + ":" +port + "/jmxrmi";
|
this.jmxUrl = "service:jmx:rmi:///jndi/rmi://" + hostIp + ":" +port + "/jmxrmi";
|
||||||
this.username = null;
|
this.username = (String) config.getTarget().getAuth().get("username");
|
||||||
this.password = null;
|
this.password = (String) config.getTarget().getAuth().get("password");
|
||||||
|
|
||||||
// connection
|
// connection
|
||||||
MBeanServerConnection beanCon;
|
MBeanServerConnection beanCon;
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class AppTest {
|
||||||
|
|
||||||
ClassLoader classLoader = getClass().getClassLoader();
|
ClassLoader classLoader = getClass().getClassLoader();
|
||||||
URL url = classLoader.getResource("config/");
|
URL url = classLoader.getResource("config/");
|
||||||
String path = classLoader.getResource("config/example1.json").getFile();
|
String path = classLoader.getResource("config/example.json").getFile();
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
Config c = mapper.readValue(new File(path),Config.class);
|
Config c = mapper.readValue(new File(path),Config.class);
|
||||||
|
|
|
@ -23,7 +23,9 @@
|
||||||
"keys" : [
|
"keys" : [
|
||||||
{"metric" : "net.connector[$0].requestCount", "key" : "requestCount"},
|
{"metric" : "net.connector[$0].requestCount", "key" : "requestCount"},
|
||||||
{"metric" : "net.connector[$0].loadOnStartup", "key" : "loadOnStartup"},
|
{"metric" : "net.connector[$0].loadOnStartup", "key" : "loadOnStartup"},
|
||||||
{"metric" : "net.connector[$0].errorCount", "key" : "errorCount"}
|
{"metric" : "net.connector[$0].errorCount", "key" : "errorCount"},
|
||||||
|
{"metric" : "net.connector[$0].objectName", "key" : "objectName"}
|
||||||
|
|
||||||
],
|
],
|
||||||
"queryInfo" : {
|
"queryInfo" : {
|
||||||
"query": "*Catalina:j2eeType=Servlet,*",
|
"query": "*Catalina:j2eeType=Servlet,*",
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
"portType" : "tcp"
|
"portType" : "tcp"
|
||||||
},
|
},
|
||||||
"auth" : {
|
"auth" : {
|
||||||
|
"username": "jmxuser",
|
||||||
|
"password": "tomcat"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schedule" : {
|
"schedule" : {
|
||||||
|
@ -63,6 +64,67 @@
|
||||||
"mappingInfo" : {
|
"mappingInfo" : {
|
||||||
"arrayColumns" : [ "GlobalRequestProcessor" ]
|
"arrayColumns" : [ "GlobalRequestProcessor" ]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"keys" : [
|
||||||
|
{"metric" : "net.connector[$0].processingTime", "key" : "processingTime"},
|
||||||
|
{"metric" : "net.connector[$0].errorCount", "key" : "errorCount"},
|
||||||
|
{"metric" : "net.connector[$0].requestCount", "key" : "requestCount"}
|
||||||
|
],
|
||||||
|
"queryInfo" : {
|
||||||
|
"query": "*Catalina:j2eeType=Servlet,*",
|
||||||
|
"extend" : {
|
||||||
|
"aliases" : [
|
||||||
|
{
|
||||||
|
"key": "Catalina:j2eeType",
|
||||||
|
"index":0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mappingInfo" : {
|
||||||
|
"arrayColumns" : [ "Servlet" ]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"keys" : [
|
||||||
|
{"metric" : "net.connector[$0].accessCount", "key" : "accessCount"},
|
||||||
|
{"metric" : "net.connector[$0].hitCount", "key" : "hitCount"}
|
||||||
|
],
|
||||||
|
"queryInfo" : {
|
||||||
|
"query": "*Catalina:type=StringCache,*",
|
||||||
|
"extend" : {
|
||||||
|
"aliases" : [
|
||||||
|
{
|
||||||
|
"key": "Catalina:type",
|
||||||
|
"index":0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mappingInfo" : {
|
||||||
|
"arrayColumns" : [ "StringCache" ]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"keys" : [
|
||||||
|
{"metric" : "net.connector[$0].jspCount", "key" : "jspCount"},
|
||||||
|
{"metric" : "net.connector[$0].jspReloadCount", "key" : "jspReloadCount"}
|
||||||
|
],
|
||||||
|
"queryInfo" : {
|
||||||
|
"query": "*Catalina:type=JspMonitor,*",
|
||||||
|
"extend" : {
|
||||||
|
"aliases" : [
|
||||||
|
{
|
||||||
|
"key": "Catalina:type",
|
||||||
|
"index":0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mappingInfo" : {
|
||||||
|
"arrayColumns" : [ "JspMonitor" ]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user