From 8ce0ab73ac6a5aae06b9ac24ffb1e0191a5ce67e Mon Sep 17 00:00:00 2001 From: geek Date: Tue, 12 Sep 2017 18:46:46 +0900 Subject: [PATCH] jmx test --- .../loafle/overflow/crawler/jmx/JmxCrawler.java | 4 ++-- src/test/java/com/loafle/AppTest.java | 2 +- src/test/resources/config/example.json | 6 +++--- src/test/resources/config/example1.json | 14 +++++++------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/loafle/overflow/crawler/jmx/JmxCrawler.java b/src/main/java/com/loafle/overflow/crawler/jmx/JmxCrawler.java index ac1e9c8..43435cb 100644 --- a/src/main/java/com/loafle/overflow/crawler/jmx/JmxCrawler.java +++ b/src/main/java/com/loafle/overflow/crawler/jmx/JmxCrawler.java @@ -81,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 = (String) config.getTarget().getAuth().get("username"); - this.password = (String) config.getTarget().getAuth().get("password"); + this.username = (String) config.getTarget().getAuth().get("id"); + this.password = (String) config.getTarget().getAuth().get("pw"); // connection MBeanServerConnection beanCon; diff --git a/src/test/java/com/loafle/AppTest.java b/src/test/java/com/loafle/AppTest.java index f19b6f1..f6d5d93 100644 --- a/src/test/java/com/loafle/AppTest.java +++ b/src/test/java/com/loafle/AppTest.java @@ -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); diff --git a/src/test/resources/config/example.json b/src/test/resources/config/example.json index 521179f..27a3675 100644 --- a/src/test/resources/config/example.json +++ b/src/test/resources/config/example.json @@ -8,7 +8,8 @@ "portType" : "tcp" }, "auth" : { - + "id": "jmxuser", + "pw": "tomcat" } }, "schedule" : { @@ -25,14 +26,13 @@ {"metric" : "net.connector[$0].loadOnStartup", "key" : "loadOnStartup"}, {"metric" : "net.connector[$0].errorCount", "key" : "errorCount"}, {"metric" : "net.connector[$0].objectName", "key" : "objectName"} - ], "queryInfo" : { "query": "*Catalina:j2eeType=Servlet,*", "extend" : { "aliases" : [ { - "key": "Catalina:j2eeType", + "key": "WebModule", "index":0 } ] diff --git a/src/test/resources/config/example1.json b/src/test/resources/config/example1.json index 70ac2f6..19c362c 100644 --- a/src/test/resources/config/example1.json +++ b/src/test/resources/config/example1.json @@ -8,8 +8,8 @@ "portType" : "tcp" }, "auth" : { - "username": "jmxuser", - "password": "tomcat" + "id": "jmxuser", + "pw": "tomcat" } }, "schedule" : { @@ -31,7 +31,7 @@ "extend" : { "aliases" : [ { - "key": "Catalina:type", + "key": "name", "index":0 } ] @@ -55,7 +55,7 @@ "extend" : { "aliases" : [ { - "key": "Catalina:type", + "key": "WebModule", "index":0 } ] @@ -76,7 +76,7 @@ "extend" : { "aliases" : [ { - "key": "Catalina:j2eeType", + "key": "name", "index":0 } ] @@ -96,7 +96,7 @@ "extend" : { "aliases" : [ { - "key": "Catalina:type", + "key": "StringCache", "index":0 } ] @@ -116,7 +116,7 @@ "extend" : { "aliases" : [ { - "key": "Catalina:type", + "key": "WebModule", "index":0 } ]