这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/bosun/conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type SystemConfProvider interface {
GetRedisHost() string
GetRedisDb() int
GetRedisPassword() string
IsRedisClientSetName() bool
GetTimeAndDate() []int
GetSearchSince() time.Duration

Expand Down
19 changes: 13 additions & 6 deletions cmd/bosun/conf/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,10 @@ type InfluxConf struct {

// DBConf stores the connection information for Bosun's internal storage
type DBConf struct {
RedisHost string
RedisDb int
RedisPassword string
RedisHost string
RedisDb int
RedisPassword string
RedisClientSetName bool

LedisDir string
LedisBindAddr string
Expand Down Expand Up @@ -228,8 +229,9 @@ func newSystemConf() *SystemConf {
DefaultRunEvery: 1,
HTTPListen: defaultHTTPListen,
DBConf: DBConf{
LedisDir: "ledis_data",
LedisBindAddr: "127.0.0.1:9565",
LedisDir: "ledis_data",
LedisBindAddr: "127.0.0.1:9565",
RedisClientSetName: true,
},
MinGroupSize: 5,
PingDuration: Duration{Duration: time.Hour * 24},
Expand Down Expand Up @@ -366,6 +368,11 @@ func (sc *SystemConf) GetRedisPassword() string {
return sc.DBConf.RedisPassword
}

// RedisClientSetName returns if CLIENT SETNAME shoud send to redis.
func (sc *SystemConf) IsRedisClientSetName() bool {
return sc.DBConf.RedisClientSetName
}

func (sc *SystemConf) GetAuthConf() *AuthConf {
return sc.AuthConf
}
Expand Down Expand Up @@ -425,7 +432,7 @@ func (sc *SystemConf) GetInternetProxy() string {
return sc.InternetProxy
}

// MaxRenderedTemplateAge returns the maximum time in days to keep rendered templates
// GetMaxRenderedTemplateAge returns the maximum time in days to keep rendered templates
// after the incident end date.
func (sc *SystemConf) GetMaxRenderedTemplateAge() int {
return sc.MaxRenderedTemplateAge
Expand Down
7 changes: 4 additions & 3 deletions cmd/bosun/conf/system_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ func TestSystemToml(t *testing.T) {
Hosts: []string{"http://ny-lselastic01.example.com:9200", "http://ny-lselastic02.example.com:9200"},
})
assert.Equal(t, sc.DBConf, DBConf{
RedisHost: "localhost:6389", // From Config
LedisDir: "ledis_data", // Default
LedisBindAddr: "127.0.0.1:9565", // Default
RedisHost: "localhost:6389", // From Config
RedisClientSetName: true,
LedisDir: "ledis_data", // Default
LedisBindAddr: "127.0.0.1:9565", // Default

}, "DBConf does not match")
assert.Equal(t, sc.SMTPConf, SMTPConf{
Expand Down
2 changes: 1 addition & 1 deletion cmd/bosun/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func quit() {
func initDataAccess(systemConf conf.SystemConfProvider) (database.DataAccess, error) {
var da database.DataAccess
if systemConf.GetRedisHost() != "" {
da = database.NewDataAccess(systemConf.GetRedisHost(), true, systemConf.GetRedisDb(), systemConf.GetRedisPassword())
da = database.NewDataAccess(systemConf.GetRedisHost(), systemConf.IsRedisClientSetName(), systemConf.GetRedisDb(), systemConf.GetRedisPassword())
} else {
_, err := database.StartLedis(systemConf.GetLedisDir(), systemConf.GetLedisBindAddr())
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions docs/system_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ Optional integer database to store bosun data. Defaults to 0.
#### RedisPassword
Optional password to use when connecting to Redis.

#### RedisClentSetName
Optional key defining the sending of client's name `bosun` to Redis. Defaults to true.
If you use Netflix/dynomite then RedisClentSetName must be set to false.

#### LedisDir
Directory in which ledis will store data. Default: `LedisDir = "ledis_data"`

Expand Down