diff --git a/src/modules/monapi/config/yaml.go b/src/modules/monapi/config/yaml.go index 55d5b061..dc88a691 100644 --- a/src/modules/monapi/config/yaml.go +++ b/src/modules/monapi/config/yaml.go @@ -25,6 +25,7 @@ type ConfYaml struct { Merge mergeSection `yaml:"merge"` Notify map[string][]string `yaml:"notify"` Link linkSection `yaml:"link"` + IndexMod string `yaml:"indexMod"` } type mergeSection struct { @@ -136,6 +137,7 @@ func Parse(ymlfile string) error { }) viper.SetDefault("alarmEnabled", "true") + viper.SetDefault("indexMod", "index") viper.SetDefault("habits.identity", "ip") diff --git a/src/modules/monapi/http/router_index.go b/src/modules/monapi/http/router_index.go index c473b251..8b9569b0 100644 --- a/src/modules/monapi/http/router_index.go +++ b/src/modules/monapi/http/router_index.go @@ -9,6 +9,7 @@ import ( "github.com/didi/nightingale/src/common/dataobj" "github.com/didi/nightingale/src/common/report" "github.com/didi/nightingale/src/models" + "github.com/didi/nightingale/src/modules/monapi/config" "github.com/gin-gonic/gin" "github.com/toolkits/pkg/errors" @@ -128,7 +129,7 @@ func Tagkv(request NidMetricRecv) ([]IndexTagkvResp, error) { func GetIndexes() []string { var indexInstances []string - instances, err := report.GetAlive("index", "rdb") + instances, err := report.GetAlive(config.Get().IndexMod, "rdb") if err != nil { return indexInstances }