This commit is contained in:
geek 2017-09-12 18:02:58 +09:00
parent bf7ee36cef
commit 87bd965376
4 changed files with 77 additions and 6 deletions

View File

@ -53,12 +53,19 @@ public class JmxCrawler extends Crawler{
logCrawler(mbeanName, attr, "not readable");
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;
try {
att = beanCon.getAttribute(mbeanName, attr.getName());
}catch (Exception e) {
e.printStackTrace();
continue;
}
if (att != null)
@ -74,8 +81,8 @@ public class JmxCrawler extends Crawler{
String port = config.getTarget().getConnection().getPort();
this.jmxUrl = "service:jmx:rmi:///jndi/rmi://" + hostIp + ":" +port + "/jmxrmi";
this.username = null;
this.password = null;
this.username = (String) config.getTarget().getAuth().get("username");
this.password = (String) config.getTarget().getAuth().get("password");
// connection
MBeanServerConnection beanCon;

View File

@ -25,7 +25,7 @@ public class AppTest {
ClassLoader classLoader = getClass().getClassLoader();
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();
Config c = mapper.readValue(new File(path),Config.class);

View File

@ -23,7 +23,9 @@
"keys" : [
{"metric" : "net.connector[$0].requestCount", "key" : "requestCount"},
{"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" : {
"query": "*Catalina:j2eeType=Servlet,*",

View File

@ -8,7 +8,8 @@
"portType" : "tcp"
},
"auth" : {
"username": "jmxuser",
"password": "tomcat"
}
},
"schedule" : {
@ -63,6 +64,67 @@
"mappingInfo" : {
"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" ]
}
}
]
}