sdf
This commit is contained in:
parent
cb1fd86aed
commit
ac3873a6ca
|
@ -36,19 +36,21 @@ public class JmxCrawler extends Crawler{
|
||||||
private MBeanReceiver receiver;
|
private MBeanReceiver receiver;
|
||||||
private List<String> whiteObjectNameList = new ArrayList<>();
|
private List<String> whiteObjectNameList = new ArrayList<>();
|
||||||
private List<List<String>> keys = new ArrayList<>();
|
private List<List<String>> keys = new ArrayList<>();
|
||||||
|
private List<String> metrics = new ArrayList<>();
|
||||||
|
|
||||||
private Map<String, String> re = new HashMap<String, String>();
|
private Map<String, String> re = new HashMap<String, String>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getInternal(Config config) throws Exception {
|
public Object getInternal(Config config) throws Exception {
|
||||||
|
|
||||||
MBeanReceiver m = new MBeanReceiver() {
|
MBeanReceiver m = (domain, attrKeys, attrName, attrType, attrDescription, value) -> re.put(attrName, value.toString());
|
||||||
@Override
|
|
||||||
public void recordBean(String domain, LinkedList<String> attrKeys, String attrName, String attrType, String attrDescription, Object value) {
|
|
||||||
re.put(attrName, value.toString());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
// MBeanReceiver m = new MBeanReceiver() {
|
||||||
|
// @Override
|
||||||
|
// public void recordBean(String domain, LinkedList<String> attrKeys, String attrName, String attrType, String attrDescription, Object value) {
|
||||||
|
// re.put(attrName, value.toString());
|
||||||
|
// }
|
||||||
|
// };
|
||||||
// "service:jmx:rmi:///jndi/rmi://192.168.1.103:9840/jmxrmi";
|
// "service:jmx:rmi:///jndi/rmi://192.168.1.103:9840/jmxrmi";
|
||||||
String hostIp = config.getTarget().getConnection().getIp();
|
String hostIp = config.getTarget().getConnection().getIp();
|
||||||
String port = config.getTarget().getConnection().getPort();
|
String port = config.getTarget().getConnection().getPort();
|
||||||
|
@ -60,6 +62,7 @@ public class JmxCrawler extends Crawler{
|
||||||
|
|
||||||
for (Item item : config.getItems()) {
|
for (Item item : config.getItems()) {
|
||||||
List<com.loafle.overflow.crawler.config.Query> querys = item.getQueries();
|
List<com.loafle.overflow.crawler.config.Query> querys = item.getQueries();
|
||||||
|
this.metrics = item.getMetrics();
|
||||||
for (Query q : querys) {
|
for (Query q : querys) {
|
||||||
this.whiteObjectNameList.add(q.getQuery());
|
this.whiteObjectNameList.add(q.getQuery());
|
||||||
this.keys.add(q.getKeys());
|
this.keys.add(q.getKeys());
|
||||||
|
@ -70,12 +73,15 @@ public class JmxCrawler extends Crawler{
|
||||||
this.doCrawler();
|
this.doCrawler();
|
||||||
|
|
||||||
Map<String, String> result = new LinkedHashMap<>();
|
Map<String, String> result = new LinkedHashMap<>();
|
||||||
|
int idx = 0;
|
||||||
|
|
||||||
for (List<String> ks : this.keys) {
|
for (List<String> ks : this.keys) {
|
||||||
for (String k : ks) {
|
for (String k : ks) {
|
||||||
for (String key : re.keySet()) {
|
for (String key : re.keySet()) {
|
||||||
if (k.equals(key)) {
|
if (k.equals(key)) {
|
||||||
result.put(key, re.get(key));
|
String metricKey = this.metrics.get(idx);
|
||||||
|
result.put(metricKey, re.get(key));
|
||||||
|
idx++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user