File tree 3 files changed +27
-5
lines changed
3 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ github.com/golang/snappy 7db9049039a047d955fe8c19b83c8ff5abd765c7
28
28
github.com/go-ole/go-ole be49f7c07711fcb603cff39e1de7c67926dc0ba7
29
29
github.com/google/go-cmp f94e52cad91c65a63acc1e75d4be223ea22e99bc
30
30
github.com/gorilla/mux 53c1911da2b537f792e7cafcb446b05ffe33b996
31
- github.com/go-redis/redis 73b70592cdaa9e6abdfcfbf97b4a90d80728c836
31
+ github.com/go-redis/redis 83fb42932f6145ce52df09860384a4653d2d332a
32
32
github.com/go-sql-driver/mysql 2e00b5cd70399450106cec6431c2e2ce3cae5034
33
33
github.com/hailocab/go-hostpool e80d13ce29ede4452c43dea11e79b9bc8a15b478
34
34
github.com/hashicorp/consul 5174058f0d2bda63fa5198ab96c33d9a909c58ed
Original file line number Diff line number Diff line change 14
14
## If no servers are specified, then localhost is used as the host.
15
15
## If no port is specified, 6379 is used
16
16
servers = ["tcp://localhost:6379"]
17
+
18
+ ## Optional TLS Config
19
+ # tls_ca = "/etc/telegraf/ca.pem"
20
+ # tls_cert = "/etc/telegraf/cert.pem"
21
+ # tls_key = "/etc/telegraf/key.pem"
22
+ ## Use TLS but skip chain & host verification
23
+ # insecure_skip_verify = true
17
24
```
18
25
19
26
### Measurements & Fields:
Original file line number Diff line number Diff line change @@ -13,11 +13,13 @@ import (
13
13
14
14
"github.com/go-redis/redis"
15
15
"github.com/influxdata/telegraf"
16
+ "github.com/influxdata/telegraf/internal/tls"
16
17
"github.com/influxdata/telegraf/plugins/inputs"
17
18
)
18
19
19
20
type Redis struct {
20
21
Servers []string
22
+ tls.ClientConfig
21
23
22
24
clients []Client
23
25
initialized bool
@@ -56,6 +58,13 @@ var sampleConfig = `
56
58
## If no servers are specified, then localhost is used as the host.
57
59
## If no port is specified, 6379 is used
58
60
servers = ["tcp://localhost:6379"]
61
+
62
+ ## Optional TLS Config
63
+ # tls_ca = "/etc/telegraf/ca.pem"
64
+ # tls_cert = "/etc/telegraf/cert.pem"
65
+ # tls_key = "/etc/telegraf/key.pem"
66
+ ## Use TLS but skip chain & host verification
67
+ # insecure_skip_verify = true
59
68
`
60
69
61
70
func (r * Redis ) SampleConfig () string {
@@ -109,12 +118,18 @@ func (r *Redis) init(acc telegraf.Accumulator) error {
109
118
address = u .Host
110
119
}
111
120
121
+ tlsConfig , err := r .ClientConfig .TLSConfig ()
122
+ if err != nil {
123
+ return err
124
+ }
125
+
112
126
client := redis .NewClient (
113
127
& redis.Options {
114
- Addr : address ,
115
- Password : password ,
116
- Network : u .Scheme ,
117
- PoolSize : 1 ,
128
+ Addr : address ,
129
+ Password : password ,
130
+ Network : u .Scheme ,
131
+ PoolSize : 1 ,
132
+ TLSConfig : tlsConfig ,
118
133
},
119
134
)
120
135
You can’t perform that action at this time.
0 commit comments