jmx test
This commit is contained in:
parent
83436d41df
commit
bf7ee36cef
|
@ -53,7 +53,14 @@ public class JmxCrawler extends Crawler{
|
|||
logCrawler(mbeanName, attr, "not readable");
|
||||
continue;
|
||||
}
|
||||
Object att = beanCon.getAttribute(mbeanName, attr.getName());
|
||||
Object att = null;
|
||||
|
||||
try {
|
||||
att = beanCon.getAttribute(mbeanName, attr.getName());
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (att != null)
|
||||
returnMap.put(attr.getName(), att.toString());
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class AppTest {
|
|||
|
||||
ClassLoader classLoader = getClass().getClassLoader();
|
||||
URL url = classLoader.getResource("config/");
|
||||
String path = classLoader.getResource("config/example.json").getFile();
|
||||
String path = classLoader.getResource("config/example1.json").getFile();
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
Config c = mapper.readValue(new File(path),Config.class);
|
||||
|
@ -34,7 +34,6 @@ public class AppTest {
|
|||
List<OFResultSet> result = (List<OFResultSet>) cr.getInternal(c);
|
||||
|
||||
print("",result);
|
||||
|
||||
}
|
||||
|
||||
private void print(String s, List<OFResultSet> mm) {
|
||||
|
|
68
src/test/resources/config/example1.json
Normal file
68
src/test/resources/config/example1.json
Normal file
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
"id" : "SOEJWEOJWOEJOSDJFOASDJFOSDFO2903870928734",
|
||||
"target" : {
|
||||
"connection" : {
|
||||
"ip" : "192.168.1.103",
|
||||
"port" : "9840",
|
||||
"ssl" : false,
|
||||
"portType" : "tcp"
|
||||
},
|
||||
"auth" : {
|
||||
|
||||
}
|
||||
},
|
||||
"schedule" : {
|
||||
"interval" : "10"
|
||||
},
|
||||
"crawler" : {
|
||||
"name":"jmx",
|
||||
"container":"java_proxy"
|
||||
},
|
||||
"items" : [
|
||||
{
|
||||
"keys" : [
|
||||
{"metric" : "net.connector[$0].maxThreads", "key" : "maxThreads"},
|
||||
{"metric" : "net.connector[$0].currentThreadCount", "key" : "currentThreadCount"},
|
||||
{"metric" : "net.connector[$0].currentThreadsBusy", "key" : "currentThreadsBusy"}
|
||||
],
|
||||
"queryInfo" : {
|
||||
"query": "*Catalina:type=ThreadPool,*",
|
||||
"extend" : {
|
||||
"aliases" : [
|
||||
{
|
||||
"key": "Catalina:type",
|
||||
"index":0
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"mappingInfo" : {
|
||||
"arrayColumns" : [ "ThreadPool" ]
|
||||
}
|
||||
},
|
||||
{
|
||||
"keys" : [
|
||||
{"metric" : "net.connector[$0].bytesSent", "key" : "bytesSent"},
|
||||
{"metric" : "net.connector[$0].bytesReceived", "key" : "bytesReceived"},
|
||||
{"metric" : "net.connector[$0].errorCount", "key" : "errorCount"},
|
||||
{"metric" : "net.connector[$0].requestCount", "key" : "requestCount"},
|
||||
{"metric" : "net.connector[$0].maxTime", "key" : "maxTime"},
|
||||
{"metric" : "net.connector[$0].processingTime", "key" : "processingTime"}
|
||||
],
|
||||
"queryInfo" : {
|
||||
"query": "*Catalina:type=GlobalRequestProcessor,*",
|
||||
"extend" : {
|
||||
"aliases" : [
|
||||
{
|
||||
"key": "Catalina:type",
|
||||
"index":0
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"mappingInfo" : {
|
||||
"arrayColumns" : [ "GlobalRequestProcessor" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
47
src/test/resources/config/example2.json
Normal file
47
src/test/resources/config/example2.json
Normal file
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"id" : "SOEJWEOJWOEJOSDJFOASDJFOSDFO2903870928734",
|
||||
"target" : {
|
||||
"connection" : {
|
||||
"ip" : "192.168.1.103",
|
||||
"port" : "9840",
|
||||
"ssl" : false,
|
||||
"portType" : "tcp"
|
||||
},
|
||||
"auth" : {
|
||||
|
||||
}
|
||||
},
|
||||
"schedule" : {
|
||||
"interval" : "10"
|
||||
},
|
||||
"crawler" : {
|
||||
"name":"jmx",
|
||||
"container":"java_proxy"
|
||||
},
|
||||
"items" : [
|
||||
{
|
||||
"keys" : [
|
||||
{"metric" : "net.connector[$1].bytesSent", "key" : "bytesSent"},
|
||||
{"metric" : "net.connector[$1].bytesReceived", "key" : "bytesReceived"},
|
||||
{"metric" : "net.connector[$1].errorCount", "key" : "errorCount"},
|
||||
{"metric" : "net.connector[$1].requestCount", "key" : "requestCount"},
|
||||
{"metric" : "net.connector[$1].maxTime", "key" : "maxTime"},
|
||||
{"metric" : "net.connector[$1].processingTime", "key" : "processingTime"}
|
||||
],
|
||||
"queryInfo" : {
|
||||
"query": "*Catalina:j2eeType=GlobalRequestProcessor,*",
|
||||
"extend" : {
|
||||
"aliases" : [
|
||||
{
|
||||
"key": "Catalina:type",
|
||||
"index":1
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"mappingInfo" : {
|
||||
"arrayColumns" : [ "GlobalRequestProcessor" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user