ResultSet 처리
This commit is contained in:
parent
ed726f368b
commit
0e74eb7dd9
|
@ -42,11 +42,10 @@ public class SQLCrawler extends Crawler {
|
|||
|
||||
for (Item item : config.getItems()) {
|
||||
|
||||
Query query = item.getQuery();
|
||||
OFResultSet resultSet = OFResultSetRow.newInstance(item);
|
||||
Map<String,Integer> meta = resultSet.getMeta();
|
||||
|
||||
rs = stmt.executeQuery((String)query.getQueryInfo().get("query"));
|
||||
rs = stmt.executeQuery((String)item.getQueryInfo().getQuery());
|
||||
|
||||
while(rs.next()) {
|
||||
List<String> row = new ArrayList<>(Arrays.asList(new String[meta.size()]));
|
||||
|
|
|
@ -22,23 +22,23 @@
|
|||
},
|
||||
"items" : [
|
||||
{
|
||||
"metrics" : [
|
||||
"net.connection_count"
|
||||
],
|
||||
"query":
|
||||
"keys" : [
|
||||
{
|
||||
"queryInfo" : {
|
||||
"query":"show status where `variable_name` = 'Connections'",
|
||||
"parseDirection" : "row",
|
||||
"valueColumn" : "Value",
|
||||
"keyColumns" : [
|
||||
"Variable_name"
|
||||
]
|
||||
},
|
||||
"keys" : [
|
||||
"Connections"
|
||||
]
|
||||
"metric":"net.connection_count",
|
||||
"key":"Connections"
|
||||
}
|
||||
|
||||
],
|
||||
"queryInfo" : {
|
||||
"query":"show status where `variable_name` = 'Connections'"
|
||||
},
|
||||
"mappingInfo" : {
|
||||
"parseDirection" : "row",
|
||||
"valueColumn" : "Value",
|
||||
"keyColumns" : [
|
||||
"Variable_name"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -22,18 +22,15 @@
|
|||
},
|
||||
"items" : [
|
||||
{
|
||||
"metrics" : [
|
||||
"net.connection_count"
|
||||
],
|
||||
"query": {
|
||||
"queryInfo":{
|
||||
"query" : "select count(pid) as connection_count from pg_catalog.pg_stat_activity where state <> 'idle'" ,
|
||||
"parseDirection":"col"
|
||||
},
|
||||
"keys" : [
|
||||
"connection_count"
|
||||
]
|
||||
"keys" : [
|
||||
{
|
||||
"metric":"net.connection_count",
|
||||
"key" : "connection_count"
|
||||
}
|
||||
],
|
||||
"queryInfo":{
|
||||
"query" : "select count(pid) as connection_count from pg_catalog.pg_stat_activity where state <> 'idle'"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -22,18 +22,17 @@
|
|||
},
|
||||
"items" : [
|
||||
{
|
||||
"metrics" : [
|
||||
"net.connection_count"
|
||||
],
|
||||
"query": {
|
||||
"queryInfo" : {
|
||||
"query": "select count(session_id) as connection_count from sys.dm_exec_connections where session_id = @@SPID",
|
||||
"parseDirection" : "col"
|
||||
},
|
||||
"keys" : [
|
||||
"connection_count"
|
||||
]
|
||||
"keys" : [
|
||||
{
|
||||
"metric" :"net.connection_count",
|
||||
"key" : "connection_count"
|
||||
}
|
||||
],
|
||||
"queryInfo" : {
|
||||
"query": "select count(session_id) as connection_count from sys.dm_exec_connections where session_id = @@SPID"
|
||||
},
|
||||
"mappingInfo" : {}
|
||||
}
|
||||
|
||||
]
|
||||
}
|
|
@ -23,23 +23,25 @@
|
|||
},
|
||||
"items" : [
|
||||
{
|
||||
"metrics" : [
|
||||
"object[$0].db[$1].datafile_size",
|
||||
"object[$0].db[$1].logfile_size"
|
||||
],
|
||||
"query": {
|
||||
"queryInfo" : {
|
||||
"query": "select object_name,instance_name, counter_name, cntr_value from sys.dm_os_performance_counters where ( counter_name = 'Data File(s) Size (KB)' or counter_name = 'Log File(s) Size (KB)' ) AND object_name = 'SQLServer:Databases'",
|
||||
"parseDirection" : "row",
|
||||
"arrayColumns" : [ "object_name","instance_name"],
|
||||
"keyColumns" : ["counter_name"],
|
||||
"valueColumn" : "cntr_value"
|
||||
},
|
||||
"keys" : [
|
||||
"Data File(s) Size (KB)",
|
||||
"Log File(s) Size (KB)"
|
||||
]
|
||||
"keys" : [
|
||||
{
|
||||
"metric" : "object[$0].db[$1].datafile_size",
|
||||
"key" : "Data File(s) Size (KB)"
|
||||
},
|
||||
{
|
||||
"metric" : "object[$0].db[$1].logfile_size",
|
||||
"key" : "Log File(s) Size (KB)"
|
||||
}
|
||||
],
|
||||
"queryInfo" : {
|
||||
"query": "select object_name,instance_name, counter_name, cntr_value from sys.dm_os_performance_counters where ( counter_name = 'Data File(s) Size (KB)' or counter_name = 'Log File(s) Size (KB)' ) AND object_name = 'SQLServer:Databases'"
|
||||
},
|
||||
"mappingInfo" : {
|
||||
"parseDirection" : "row",
|
||||
"arrayColumns" : [ "object_name","instance_name"],
|
||||
"keyColumns" : ["counter_name"],
|
||||
"valueColumn" : "cntr_value"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user