github.com/netdata/go.d.plugin@v0.58.1/modules/elasticsearch/init.go (about) 1 // SPDX-License-Identifier: GPL-3.0-or-later 2 3 package elasticsearch 4 5 import ( 6 "errors" 7 "net/http" 8 9 "github.com/netdata/go.d.plugin/pkg/web" 10 ) 11 12 func (es *Elasticsearch) validateConfig() error { 13 if es.URL == "" { 14 return errors.New("URL not set") 15 } 16 if !(es.DoNodeStats || es.DoClusterHealth || es.DoClusterStats || es.DoIndicesStats) { 17 return errors.New("all API calls are disabled") 18 } 19 if _, err := web.NewHTTPRequest(es.Request); err != nil { 20 return err 21 } 22 return nil 23 } 24 25 func (es *Elasticsearch) initHTTPClient() (*http.Client, error) { 26 return web.NewHTTPClient(es.Client) 27 }