This commit is contained in:
geek 2017-09-06 18:25:16 +09:00
parent 83436d41df
commit bf7ee36cef
4 changed files with 124 additions and 3 deletions

View File

@ -53,7 +53,14 @@ public class JmxCrawler extends Crawler{
logCrawler(mbeanName, attr, "not readable"); logCrawler(mbeanName, attr, "not readable");
continue; 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) if (att != null)
returnMap.put(attr.getName(), att.toString()); returnMap.put(attr.getName(), att.toString());
} }

View File

@ -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/example.json").getFile(); String path = classLoader.getResource("config/example1.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);
@ -34,7 +34,6 @@ public class AppTest {
List<OFResultSet> result = (List<OFResultSet>) cr.getInternal(c); List<OFResultSet> result = (List<OFResultSet>) cr.getInternal(c);
print("",result); print("",result);
} }
private void print(String s, List<OFResultSet> mm) { private void print(String s, List<OFResultSet> mm) {

View 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" ]
}
}
]
}

View 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" ]
}
}
]
}