fix config
This commit is contained in:
parent
e03b2ebab2
commit
892c4e2653
|
@ -37,7 +37,7 @@ public class WMICrawlerWindows extends WMICrawlerOS {
|
||||||
|
|
||||||
cItem = config.getItems().get(cIndexI);
|
cItem = config.getItems().get(cIndexI);
|
||||||
|
|
||||||
query = (String)cItem.getQueryInfo().get("query");
|
query = cItem.getQueryInfo().getQuery();
|
||||||
|
|
||||||
wmiconnect = connectServer(config);
|
wmiconnect = connectServer(config);
|
||||||
|
|
||||||
|
@ -111,40 +111,40 @@ public class WMICrawlerWindows extends WMICrawlerOS {
|
||||||
|
|
||||||
return ofResultSet;
|
return ofResultSet;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
protected void getMultiValue(EnumVariant enumVariant, Query cQuery, Item cItem, int idxMetric, Map<String, String> resultMap) {
|
// protected void getMultiValue(EnumVariant enumVariant, Query cQuery, Item cItem, int idxMetric, Map<String, String> resultMap) {
|
||||||
|
//
|
||||||
Variant vItem = null;
|
// Variant vItem = null;
|
||||||
Dispatch item = null;
|
// Dispatch item = null;
|
||||||
|
//
|
||||||
|
//
|
||||||
int keyIdx = 0;
|
// int keyIdx = 0;
|
||||||
while (enumVariant.hasMoreElements()) {
|
// while (enumVariant.hasMoreElements()) {
|
||||||
|
//
|
||||||
vItem = enumVariant.nextElement();
|
// vItem = enumVariant.nextElement();
|
||||||
item = vItem.toDispatch();
|
// item = vItem.toDispatch();
|
||||||
|
//
|
||||||
|
//
|
||||||
String name = null;
|
// String name = null;
|
||||||
String value = null;
|
// String value = null;
|
||||||
Variant vValue = null;
|
// Variant vValue = null;
|
||||||
|
//
|
||||||
for(int indexI = 0 ; indexI < cQuery.getKeys().size(); ++indexI) {
|
// for(int indexI = 0 ; indexI < cQuery.getKeys().size(); ++indexI) {
|
||||||
name = cQuery.getKeys().get(indexI);
|
// name = cQuery.getKeys().get(indexI);
|
||||||
vValue = Dispatch.call(item, name);
|
// vValue = Dispatch.call(item, name);
|
||||||
value = vValue.toString();
|
// value = vValue.toString();
|
||||||
String keyStr = convertArrayKey(cItem.getMetrics().get(indexI),keyIdx );
|
// String keyStr = convertArrayKey(cItem.getMetrics().get(indexI),keyIdx );
|
||||||
resultMap.put(keyStr, value);
|
// resultMap.put(keyStr, value);
|
||||||
vValue.safeRelease();
|
// vValue.safeRelease();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
vItem.safeRelease();
|
// vItem.safeRelease();
|
||||||
item.safeRelease();
|
// item.safeRelease();
|
||||||
++idxMetric;
|
// ++idxMetric;
|
||||||
++keyIdx;
|
// ++keyIdx;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
|
||||||
protected String convertArrayKey(String key, int index) {
|
protected String convertArrayKey(String key, int index) {
|
||||||
int idx = key.indexOf("[");
|
int idx = key.indexOf("[");
|
||||||
|
@ -168,33 +168,33 @@ public class WMICrawlerWindows extends WMICrawlerOS {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void getSingleValue(EnumVariant enumVariant, Query cQuery, Item cItem, int idxMetric, Map<String, String> resultMap) {
|
// protected void getSingleValue(EnumVariant enumVariant, Query cQuery, Item cItem, int idxMetric, Map<String, String> resultMap) {
|
||||||
|
//
|
||||||
Variant vItem = null;
|
// Variant vItem = null;
|
||||||
Dispatch item = null;
|
// Dispatch item = null;
|
||||||
|
//
|
||||||
while (enumVariant.hasMoreElements()) {
|
// while (enumVariant.hasMoreElements()) {
|
||||||
|
//
|
||||||
vItem = enumVariant.nextElement();
|
// vItem = enumVariant.nextElement();
|
||||||
item = vItem.toDispatch();
|
// item = vItem.toDispatch();
|
||||||
|
//
|
||||||
String name = null;
|
// String name = null;
|
||||||
String value = null;
|
// String value = null;
|
||||||
Variant vValue = null;
|
// Variant vValue = null;
|
||||||
|
//
|
||||||
for(int indexI = 0 ; indexI < cQuery.getKeys().size(); ++indexI) {
|
// for(int indexI = 0 ; indexI < cQuery.getKeys().size(); ++indexI) {
|
||||||
name = cQuery.getKeys().get(indexI);
|
// name = cQuery.getKeys().get(indexI);
|
||||||
vValue = Dispatch.call(item, name);
|
// vValue = Dispatch.call(item, name);
|
||||||
value = vValue.toString();
|
// value = vValue.toString();
|
||||||
resultMap.put(cItem.getMetrics().get(idxMetric++), value);
|
// resultMap.put(cItem.getMetrics().get(idxMetric++), value);
|
||||||
vValue.safeRelease();
|
// vValue.safeRelease();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
vItem.safeRelease();
|
// vItem.safeRelease();
|
||||||
item.safeRelease();
|
// item.safeRelease();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
|
||||||
protected List<String> getColumns(Dispatch item) {
|
protected List<String> getColumns(Dispatch item) {
|
||||||
|
|
||||||
|
|
|
@ -20,35 +20,42 @@
|
||||||
},
|
},
|
||||||
"items" : [
|
"items" : [
|
||||||
{
|
{
|
||||||
"metrics": [
|
"keys" : [
|
||||||
"cpu[$0].usage.system",
|
{"metric" : "cpu[$0].usage.system", "key":"PercentProcessorTime"},
|
||||||
"cpu[$0].usage.idle",
|
{"metric" : "cpu[$0].usage.idle", "key":"PercentIdleTime"},
|
||||||
"cpu[$0].usage.user"
|
{"metric" : "cpu[$0].usage.user", "key":"PercentUserTime"}
|
||||||
],
|
],
|
||||||
"queryInfo" : {
|
"queryInfo" : {
|
||||||
"query": "select PercentProcessorTime, PercentIdleTime, PercentUserTime,Name from Win32_PerfFormattedData_PerfOS_Processor",
|
"query": "select PercentProcessorTime, PercentIdleTime, PercentUserTime,Name from Win32_PerfFormattedData_PerfOS_Processor",
|
||||||
|
"extend" : {
|
||||||
|
"nameSpace":"root/cimv2",
|
||||||
|
"wmicPath": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mappingInfo" : {
|
||||||
"parseDirection" : "col",
|
"parseDirection" : "col",
|
||||||
"arrayColumns" : [ "Name"]
|
"arrayColumns" : [ "Name"]
|
||||||
},
|
|
||||||
"keys":["PercentProcessorTime","PercentIdleTime", "PercentUserTime"]
|
|
||||||
}
|
}
|
||||||
,{
|
}
|
||||||
"metrics": [
|
,
|
||||||
"cpu.usage.system",
|
{
|
||||||
"cpu.usage.idle",
|
"keys" : [
|
||||||
"cpu.usage.user"
|
{"metric" : "cpu.usage.system", "key":"PercentProcessorTime"},
|
||||||
|
{"metric" : "cpu.usage.idle", "key":"PercentIdleTime"},
|
||||||
|
{"metric" : "cpu.usage.user", "key":"PercentUserTime"}
|
||||||
],
|
],
|
||||||
|
|
||||||
"queryInfo" : {
|
"queryInfo" : {
|
||||||
"query": "select PercentProcessorTime, PercentIdleTime, PercentUserTime,Name from Win32_PerfFormattedData_PerfOS_Processor where Name='_Total'",
|
"query": "select PercentProcessorTime, PercentIdleTime, PercentUserTime,Name from Win32_PerfFormattedData_PerfOS_Processor where Name='_Total'",
|
||||||
"parseDirection" : "col"
|
"extend" : {
|
||||||
|
"nameSpace":"root/cimv2",
|
||||||
},
|
"wmicPath": ""
|
||||||
"keys":["PercentProcessorTime","PercentIdleTime", "PercentUserTime"]
|
}
|
||||||
|
},
|
||||||
|
"mappingInfo" : {
|
||||||
|
"parseDirection" : "col",
|
||||||
|
"arrayColumns" : [ "Name"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user