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

View File

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