diff --git a/plugin/api/index_management/elasticsearch.go b/plugin/api/index_management/elasticsearch.go index ba815d6c..2966d4a9 100644 --- a/plugin/api/index_management/elasticsearch.go +++ b/plugin/api/index_management/elasticsearch.go @@ -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) diff --git a/plugin/setup/setup.go b/plugin/setup/setup.go index 5efcb58f..950d7c46 100644 --- a/plugin/setup/setup.go +++ b/plugin/setup/setup.go @@ -399,7 +399,16 @@ 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) + ctx := pipeline.AcquireContext() + var ( + username string + password string + ) + if cfg.BasicAuth != nil { + username = cfg.BasicAuth.Username + password = cfg.BasicAuth.Password + } + _,err,_:=replay.ReplayLines(ctx,lines,cfg.Schema,cfg.Host,username,password) if err!=nil{ log.Error(err) }