Merge branch 'master' into credential

This commit is contained in:
liugq 2023-02-13 11:35:49 +08:00
commit 46432da7aa
2 changed files with 10 additions and 2 deletions

View File

@ -86,7 +86,7 @@ func (handler APIHandler) ElasticsearchOverviewAction(w http.ResponseWriter, req
if err != nil{
log.Error(err)
}
if v, ok := hostCount.(float64); ok && v == 0 {
if v, ok := hostCount.(float64); (ok && v == 0) || hostCount == nil {
hostCount, err = handler.getMetricCount(orm.GetIndexName(elastic.NodeConfig{}), "metadata.host", clusterIDs)
if err != nil{
log.Error(err)

View File

@ -417,7 +417,15 @@ func (module *Module) initialize(w http.ResponseWriter, r *http.Request, ps http
if dslWriteSuccess{
lines := util.FileGetLines(dslFile)
_,err,_:=replay.ReplayLines(pipeline.AcquireContext(),lines,cfg.Schema,cfg.Host)
var (
username string
password string
)
if cfg.BasicAuth != nil {
username = cfg.BasicAuth.Username
password = cfg.BasicAuth.Password
}
_,err,_:=replay.ReplayLines(pipeline.AcquireContext(),lines,cfg.Schema,cfg.Host,username,password)
if err!=nil{
log.Error(err)
}