blob: 380f4bb3397a00d87bc01abc97009b7830bec77e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// SPDX-License-Identifier: GPL-3.0-or-later
package zookeeper
import (
"crypto/tls"
"errors"
"fmt"
"github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/socket"
"github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/tlscfg"
)
func (z *Zookeeper) verifyConfig() error {
if z.Address == "" {
return errors.New("address not set")
}
return nil
}
func (z *Zookeeper) initZookeeperFetcher() (fetcher, error) {
var tlsConf *tls.Config
var err error
if z.UseTLS {
tlsConf, err = tlscfg.NewTLSConfig(z.TLSConfig)
if err != nil {
return nil, fmt.Errorf("creating tls config : %v", err)
}
}
sock := socket.New(socket.Config{
Address: z.Address,
ConnectTimeout: z.Timeout.Duration(),
ReadTimeout: z.Timeout.Duration(),
WriteTimeout: z.Timeout.Duration(),
TLSConf: tlsConf,
})
return &zookeeperFetcher{Client: sock}, nil
}
|