diff --git a/cmd/bosun/conf/conf.go b/cmd/bosun/conf/conf.go index 44ca588360..8342fece4f 100644 --- a/cmd/bosun/conf/conf.go +++ b/cmd/bosun/conf/conf.go @@ -45,6 +45,7 @@ type SystemConfProvider interface { GetRedisHost() string GetRedisDb() int GetRedisPassword() string + IsRedisClientSetName() bool GetTimeAndDate() []int GetSearchSince() time.Duration diff --git a/cmd/bosun/conf/system.go b/cmd/bosun/conf/system.go index 8776d5ba06..3ca304115f 100644 --- a/cmd/bosun/conf/system.go +++ b/cmd/bosun/conf/system.go @@ -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 @@ -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}, @@ -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 } @@ -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 diff --git a/cmd/bosun/conf/system_test.go b/cmd/bosun/conf/system_test.go index 9f9c076618..4cff9cd6aa 100644 --- a/cmd/bosun/conf/system_test.go +++ b/cmd/bosun/conf/system_test.go @@ -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{ diff --git a/cmd/bosun/main.go b/cmd/bosun/main.go index e1bb9cab53..886fa33451 100644 --- a/cmd/bosun/main.go +++ b/cmd/bosun/main.go @@ -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 { diff --git a/docs/system_configuration.md b/docs/system_configuration.md index b7d5125053..6c52864665 100644 --- a/docs/system_configuration.md +++ b/docs/system_configuration.md @@ -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"`