sdf
This commit is contained in:
parent
cb1fd86aed
commit
ac3873a6ca
|
@ -36,19 +36,21 @@ public class JmxCrawler extends Crawler{
|
|||
private MBeanReceiver receiver;
|
||||
private List<String> whiteObjectNameList = new ArrayList<>();
|
||||
private List<List<String>> keys = new ArrayList<>();
|
||||
private List<String> metrics = new ArrayList<>();
|
||||
|
||||
private Map<String, String> re = new HashMap<String, String>();
|
||||
|
||||
@Override
|
||||
public Object getInternal(Config config) throws Exception {
|
||||
|
||||
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());
|
||||
}
|
||||
};
|
||||
MBeanReceiver m = (domain, attrKeys, attrName, attrType, attrDescription, 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";
|
||||
String hostIp = config.getTarget().getConnection().getIp();
|
||||
String port = config.getTarget().getConnection().getPort();
|
||||
|
@ -60,6 +62,7 @@ public class JmxCrawler extends Crawler{
|
|||
|
||||
for (Item item : config.getItems()) {
|
||||
List<com.loafle.overflow.crawler.config.Query> querys = item.getQueries();
|
||||
this.metrics = item.getMetrics();
|
||||
for (Query q : querys) {
|
||||
this.whiteObjectNameList.add(q.getQuery());
|
||||
this.keys.add(q.getKeys());
|
||||
|
@ -70,12 +73,15 @@ public class JmxCrawler extends Crawler{
|
|||
this.doCrawler();
|
||||
|
||||
Map<String, String> result = new LinkedHashMap<>();
|
||||
int idx = 0;
|
||||
|
||||
for (List<String> ks : this.keys) {
|
||||
for (String k : ks) {
|
||||
for (String key : re.keySet()) {
|
||||
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