Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions inputs/zookeeper/zookeeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package zookeeper
import (
crypto_tls "crypto/tls"
"fmt"
"io/ioutil"
"io"
"log"
"net"
"regexp"
Expand All @@ -26,7 +26,7 @@ const (
)

var (
versionRE = regexp.MustCompile(`^([0-9]+\.[0-9]+\.[0-9]+).*$`)
versionRE = regexp.MustCompile(` ^ ([0-9]+\.[0-9]+\.[0-9]+).*$`)
metricNameReplacer = strings.NewReplacer("-", "_", ".", "_")
)

Expand Down Expand Up @@ -91,6 +91,10 @@ func (ins *Instance) Init() error {
if len(ins.ZkHosts()) == 0 {
return types.ErrInstancesEmpty
}
// set default timeout
if ins.Timeout == 0 {
ins.Timeout = 10
}
return nil
}

Expand Down Expand Up @@ -242,7 +246,7 @@ func sendZookeeperCmd(conn net.Conn, cmd string) string {
return ""
}

res, err := ioutil.ReadAll(conn)
res, err := io.ReadAll(conn)
if err != nil {
log.Printf("E! failed read Zookeeper command: '%s' response from '%s': %s", cmd, conn.RemoteAddr().String(), err)
return ""
Expand Down