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