Add means to specify server password for redis input (#4669)
This commit is contained in:
parent
23a8498963
commit
ed28cfb9f6
|
@ -18,7 +18,8 @@ import (
|
|||
)
|
||||
|
||||
type Redis struct {
|
||||
Servers []string
|
||||
Servers []string
|
||||
Password string
|
||||
tls.ClientConfig
|
||||
|
||||
clients []Client
|
||||
|
@ -59,6 +60,9 @@ var sampleConfig = `
|
|||
## If no port is specified, 6379 is used
|
||||
servers = ["tcp://localhost:6379"]
|
||||
|
||||
## specify server password
|
||||
# password = "s#cr@t%"
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
|
@ -110,6 +114,9 @@ func (r *Redis) init(acc telegraf.Accumulator) error {
|
|||
password = pw
|
||||
}
|
||||
}
|
||||
if len(r.Password) > 0 {
|
||||
password = r.Password
|
||||
}
|
||||
|
||||
var address string
|
||||
if u.Scheme == "unix" {
|
||||
|
|
Loading…
Reference in New Issue