monapi get index configurable

This commit is contained in:
710leo 2020-11-21 00:43:33 +08:00
parent d5430256c7
commit 79d8aeee11
2 changed files with 4 additions and 1 deletions

View File

@ -25,6 +25,7 @@ type ConfYaml struct {
Merge mergeSection `yaml:"merge"` Merge mergeSection `yaml:"merge"`
Notify map[string][]string `yaml:"notify"` Notify map[string][]string `yaml:"notify"`
Link linkSection `yaml:"link"` Link linkSection `yaml:"link"`
IndexMod string `yaml:"indexMod"`
} }
type mergeSection struct { type mergeSection struct {
@ -136,6 +137,7 @@ func Parse(ymlfile string) error {
}) })
viper.SetDefault("alarmEnabled", "true") viper.SetDefault("alarmEnabled", "true")
viper.SetDefault("indexMod", "index")
viper.SetDefault("habits.identity", "ip") viper.SetDefault("habits.identity", "ip")

View File

@ -9,6 +9,7 @@ import (
"github.com/didi/nightingale/src/common/dataobj" "github.com/didi/nightingale/src/common/dataobj"
"github.com/didi/nightingale/src/common/report" "github.com/didi/nightingale/src/common/report"
"github.com/didi/nightingale/src/models" "github.com/didi/nightingale/src/models"
"github.com/didi/nightingale/src/modules/monapi/config"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/toolkits/pkg/errors" "github.com/toolkits/pkg/errors"
@ -128,7 +129,7 @@ func Tagkv(request NidMetricRecv) ([]IndexTagkvResp, error) {
func GetIndexes() []string { func GetIndexes() []string {
var indexInstances []string var indexInstances []string
instances, err := report.GetAlive("index", "rdb") instances, err := report.GetAlive(config.Get().IndexMod, "rdb")
if err != nil { if err != nil {
return indexInstances return indexInstances
} }