remodeling

This commit is contained in:
jackdaw@loafle.com 2017-04-27 20:34:07 +09:00
parent d2ca696119
commit 297afd4dc1
6 changed files with 131 additions and 15 deletions

View File

@ -11,6 +11,7 @@ import (
"os"
"strings"
"sync"
"fmt"
)
type configManager struct {
@ -19,7 +20,7 @@ type configManager struct {
addCh chan interface{}
removeCh chan interface{}
configs map[string]*config_manager.Config
configs map[string] *config_manager.Config
globalConfig config_manager.GlobalConfig
}
@ -190,6 +191,6 @@ func (c *configManager) GetGlobalConfig() *config_manager.GlobalConfig {
func (c *configManager) GetCrawlerById(id string) *config_manager.Config {
return c.configs[id]
}
func (c *configManager) GetCrawlers() map[string]*config_manager.Config {
func (c *configManager) GetCrawlers() map[string] *config_manager.Config {
return c.configs
}

View File

@ -22,6 +22,13 @@ func TestLoadConfig(t *testing.T) {
data :=<- ch
c := data.(config_manager.ConfigManager)
cc := c.GetCrawlers()
//ccc := cc["75045c53-a78d-4589-b8c1-4482cab720b6"]
//
//mmmm := ccc.Items[0].Keys[0].Metric
//
//fmt.Println(mmmm)
//
assert.NotEqual(t, len(cc),0)
}()

View File

@ -8,8 +8,11 @@
"portType" : "tcp"
},
"auth" : {
}
"url":"jdbc:sqlserver://192.168.1.106:1433;",
"id":"sa",
"pw":"qwe123",
"query" : "select * from master.dbo.sysprocesses"
}
},
"schedule" : {
"interval" : "10"
@ -18,6 +21,30 @@
"name":"redis",
"container":"java_proxy"
},
"items" : [
]
"items" : [
{
"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'",
"extend" : {
"test":"test"
}
},
"mappingInfo" : {
"parseDirection" : "row",
"arrayColumns" : [ "object_name","instance_name"],
"keyColumns" : ["counter_name"],
"valueColumn" : "cntr_value"
}
}
]
}

View File

@ -8,8 +8,11 @@
"portType" : "tcp"
},
"auth" : {
}
"url":"jdbc:sqlserver://192.168.1.106:1433;",
"id":"sa",
"pw":"qwe123",
"query" : "select * from master.dbo.sysprocesses"
}
},
"schedule" : {
"interval" : "10"
@ -19,5 +22,29 @@
"container":"java_proxy"
},
"items" : [
]
{
"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'",
"extend" : {
"test":"test"
}
},
"mappingInfo" : {
"parseDirection" : "row",
"arrayColumns" : [ "object_name","instance_name"],
"keyColumns" : ["counter_name"],
"valueColumn" : "cntr_value"
}
}
]
}

View File

@ -8,8 +8,11 @@
"portType" : "tcp"
},
"auth" : {
}
"url":"jdbc:sqlserver://192.168.1.106:1433;",
"id":"sa",
"pw":"qwe123",
"query" : "select * from master.dbo.sysprocesses"
}
},
"schedule" : {
"interval" : "10"
@ -19,5 +22,29 @@
"container":"network_proxy"
},
"items" : [
]
{
"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'",
"extend" : {
"test":"test"
}
},
"mappingInfo" : {
"parseDirection" : "row",
"arrayColumns" : [ "object_name","instance_name"],
"keyColumns" : ["counter_name"],
"valueColumn" : "cntr_value"
}
}
]
}

View File

@ -2,13 +2,16 @@
"id" : "123980918237",
"target" : {
"connection" : {
"ip" : "192.168.1.104",
"port" : "6379",
"ip" : "192.168.1.103",
"port" : "1433",
"ssl" : false,
"portType" : "tcp"
},
"auth" : {
"url":"jdbc:sqlserver://192.168.1.106:1433;",
"id":"sa",
"pw":"qwe123",
"query" : "select * from master.dbo.sysprocesses"
}
},
"schedule" : {
@ -19,5 +22,29 @@
"container":"network_proxy"
},
"items" : [
{
"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'",
"extend" : {
"test":"test"
}
},
"mappingInfo" : {
"parseDirection" : "row",
"arrayColumns" : [ "object_name","instance_name"],
"keyColumns" : ["counter_name"],
"valueColumn" : "cntr_value"
}
}
]
}