config process
This commit is contained in:
snoop 2017-04-26 11:29:30 +09:00
parent e5f44a4a06
commit 286fd47b6c
2 changed files with 22 additions and 66 deletions

View File

@ -25,7 +25,7 @@ public class WMICrawlerWindows extends WMICrawlerOS {
String query = "";
Item cItem = null;
Query cQuery = null;
// int idxMetric = 0;
@ -37,8 +37,7 @@ public class WMICrawlerWindows extends WMICrawlerOS {
cItem = config.getItems().get(cIndexI);
cQuery = cItem.getQuery();
query = (String)cQuery.getQueryInfo().get("query");
query = (String)cItem.getQueryInfo().get("query");
wmiconnect = connectServer(config);
@ -89,7 +88,7 @@ public class WMICrawlerWindows extends WMICrawlerOS {
List<String> row = null;
List<String> columns = (List<String>)citem.getQuery().getQueryInfo().get("arrayColumns");
List<String> columns = (List<String>)citem.getQueryInfo().get("arrayColumns");
while (enumVariant.hasMoreElements()) {
@ -98,8 +97,8 @@ public class WMICrawlerWindows extends WMICrawlerOS {
vItem = enumVariant.nextElement();
item = vItem.toDispatch();
for( int indexI = 0; indexI < citem.getQuery().getKeys().size(); ++indexI) {
vValue = Dispatch.call(item, citem.getQuery().getKeys().get(indexI));
for( int indexI = 0; indexI < citem.getKeys().size(); ++indexI) {
vValue = Dispatch.call(item, citem.getKeys().get(indexI));
value = vValue.toString();
vValue.safeRelease();
row.add(value);
@ -126,43 +125,6 @@ public class WMICrawlerWindows extends WMICrawlerOS {
return ofResultSet;
}
protected void getMultiValue(EnumVariant enumVariant,Query cQuery, Map<String, String> resultMap) {
Variant vItem = null;
Dispatch item = null;
String indexColumn = (String)cQuery.getQueryInfo().get("indexColumn");
Variant vValue = null;
Variant vColumn = null;
String value = null;
String columnStr = null;
while (enumVariant.hasMoreElements()) {
vItem = enumVariant.nextElement();
item = vItem.toDispatch();
vColumn = Dispatch.call(item, indexColumn);
columnStr = vColumn.toString();
vColumn.safeRelease();
for( int indexI = 0; indexI < cQuery.getKeys().size(); ++indexI) {
vValue = Dispatch.call(item, cQuery.getKeys().get(indexI));
value = vValue.toString();
vValue.safeRelease();
}
vItem.safeRelease();
item.safeRelease();
}
}
protected void getMultiValue(EnumVariant enumVariant, Query cQuery, Item cItem, int idxMetric, Map<String, String> resultMap) {
Variant vItem = null;

View File

@ -15,19 +15,16 @@
"interval" : "10"
},
"crawler" : {
"name":"redis_protocol_crawler",
"container":"network_crawler"
"name":"wmi_crawler",
"container":"java_proxy"
},
"items" : [
{
"metrics": [
"cpu[$0].usage.system",
"cpu[$0].usage.idle",
"cpu[$0].usage.user"
],
"query":
{
"queryInfo": {
"query":"select PercentProcessorTime, PercentIdleTime, PercentUserTime,Name from Win32_PerfFormattedData_PerfOS_Processor",
"parseDirection" : "col",
@ -35,23 +32,20 @@
},
"keys":["PercentProcessorTime","PercentIdleTime", "PercentUserTime"]
}
}
,{
"metrics": [
"cpu.usage.system",
"cpu.usage.idle",
"cpu.usage.user"
],
"query":
{
"queryInfo": {
"query":"select PercentProcessorTime, PercentIdleTime, PercentUserTime,Name from Win32_PerfFormattedData_PerfOS_Processor where Name='_Total'",
"parseDirection" : "col"
},
"keys":["PercentProcessorTime","PercentIdleTime", "PercentUserTime"]
}
}