diff --git a/probe/elasticsearch.go b/probe/elasticsearch.go index cce60da..fb2b6ef 100644 --- a/probe/elasticsearch.go +++ b/probe/elasticsearch.go @@ -80,7 +80,7 @@ type EsProbe struct { controlChan chan bool } -func NewEsProbe(clusterName string, endpoint string, clusterConfig common.Cluster, config *common.Config, consulClient *api.Client, controlChan chan bool) (EsProbe, error) { +func NewEsProbe(clusterName string, clusterConfig common.Cluster, config *common.Config, consulClient *api.Client, controlChan chan bool) (EsProbe, error) { var allEverKnownEsNodes []string esNodesList, err := common.DiscoverNodesForService(consulClient, clusterConfig.Name) if err != nil { @@ -88,7 +88,7 @@ func NewEsProbe(clusterName string, endpoint string, clusterConfig common.Cluste } allEverKnownEsNodes = common.UpdateEverKnownNodes(allEverKnownEsNodes, esNodesList) - client, err := initEsClient(clusterConfig.Scheme, endpoint, config.ElasticsearchUser, config.ElasticsearchPassword) + client, err := initEsClient(clusterConfig.Scheme, clusterConfig.Endpoint, config.ElasticsearchUser, config.ElasticsearchPassword) if err != nil { return EsProbe{}, errors.Wrapf(err, "Failed to init elasticsearch client for cluster %s", clusterName) } diff --git a/watcher/watcher.go b/watcher/watcher.go index adcfd52..6706393 100644 --- a/watcher/watcher.go +++ b/watcher/watcher.go @@ -90,8 +90,10 @@ func (w *Watcher) createNewEsProbes(servicesToAdd map[string]common.Cluster) { continue } + clusterConfig.Endpoint = endpoint + probeChan = make(chan bool) - esProbe, err := probe.NewEsProbe(cluster, endpoint, clusterConfig, w.config, w.consulClient, probeChan) + esProbe, err := probe.NewEsProbe(cluster, clusterConfig, w.config, w.consulClient, probeChan) if err != nil { log.Errorf("Error while creating probe: %s", err.Error())