Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
telegraf-nftables
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Due to inactivity, this project is scheduled to be deleted on 2035-04-24.
Why is this scheduled?
Show more breadcrumbs
vqgroup
telegraf-nftables
Commits
3ef4dff4
Commit
3ef4dff4
authored
6 years ago
by
Leszek Charkiewicz
Committed by
Daniel Nelson
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add SSL/TLS support to Redis input (#4236)
parent
dfe7b5ee
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Godeps
+1
-1
1 addition, 1 deletion
Godeps
plugins/inputs/redis/README.md
+7
-0
7 additions, 0 deletions
plugins/inputs/redis/README.md
plugins/inputs/redis/redis.go
+19
-4
19 additions, 4 deletions
plugins/inputs/redis/redis.go
with
27 additions
and
5 deletions
Godeps
+
1
−
1
View file @
3ef4dff4
...
@@ -28,7 +28,7 @@ github.com/golang/snappy 7db9049039a047d955fe8c19b83c8ff5abd765c7
...
@@ -28,7 +28,7 @@ github.com/golang/snappy 7db9049039a047d955fe8c19b83c8ff5abd765c7
github.com/go-ole/go-ole be49f7c07711fcb603cff39e1de7c67926dc0ba7
github.com/go-ole/go-ole be49f7c07711fcb603cff39e1de7c67926dc0ba7
github.com/google/go-cmp f94e52cad91c65a63acc1e75d4be223ea22e99bc
github.com/google/go-cmp f94e52cad91c65a63acc1e75d4be223ea22e99bc
github.com/gorilla/mux 53c1911da2b537f792e7cafcb446b05ffe33b996
github.com/gorilla/mux 53c1911da2b537f792e7cafcb446b05ffe33b996
github.com/go-redis/redis
73b70592cdaa9e6abdfcfbf97b4a90d80728c836
github.com/go-redis/redis
83fb42932f6145ce52df09860384a4653d2d332a
github.com/go-sql-driver/mysql 2e00b5cd70399450106cec6431c2e2ce3cae5034
github.com/go-sql-driver/mysql 2e00b5cd70399450106cec6431c2e2ce3cae5034
github.com/hailocab/go-hostpool e80d13ce29ede4452c43dea11e79b9bc8a15b478
github.com/hailocab/go-hostpool e80d13ce29ede4452c43dea11e79b9bc8a15b478
github.com/hashicorp/consul 5174058f0d2bda63fa5198ab96c33d9a909c58ed
github.com/hashicorp/consul 5174058f0d2bda63fa5198ab96c33d9a909c58ed
...
...
This diff is collapsed.
Click to expand it.
plugins/inputs/redis/README.md
+
7
−
0
View file @
3ef4dff4
...
@@ -14,6 +14,13 @@
...
@@ -14,6 +14,13 @@
## If no servers are specified, then localhost is used as the host.
## If no servers are specified, then localhost is used as the host.
## If no port is specified, 6379 is used
## If no port is specified, 6379 is used
servers = ["tcp://localhost:6379"]
servers = ["tcp://localhost:6379"]
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
# insecure_skip_verify = true
```
```
### Measurements & Fields:
### Measurements & Fields:
...
...
This diff is collapsed.
Click to expand it.
plugins/inputs/redis/redis.go
+
19
−
4
View file @
3ef4dff4
...
@@ -13,11 +13,13 @@ import (
...
@@ -13,11 +13,13 @@ import (
"github.com/go-redis/redis"
"github.com/go-redis/redis"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal/tls"
"github.com/influxdata/telegraf/plugins/inputs"
"github.com/influxdata/telegraf/plugins/inputs"
)
)
type
Redis
struct
{
type
Redis
struct
{
Servers
[]
string
Servers
[]
string
tls
.
ClientConfig
clients
[]
Client
clients
[]
Client
initialized
bool
initialized
bool
...
@@ -56,6 +58,13 @@ var sampleConfig = `
...
@@ -56,6 +58,13 @@ var sampleConfig = `
## If no servers are specified, then localhost is used as the host.
## If no servers are specified, then localhost is used as the host.
## If no port is specified, 6379 is used
## If no port is specified, 6379 is used
servers = ["tcp://localhost:6379"]
servers = ["tcp://localhost:6379"]
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
# insecure_skip_verify = true
`
`
func
(
r
*
Redis
)
SampleConfig
()
string
{
func
(
r
*
Redis
)
SampleConfig
()
string
{
...
@@ -109,12 +118,18 @@ func (r *Redis) init(acc telegraf.Accumulator) error {
...
@@ -109,12 +118,18 @@ func (r *Redis) init(acc telegraf.Accumulator) error {
address
=
u
.
Host
address
=
u
.
Host
}
}
tlsConfig
,
err
:=
r
.
ClientConfig
.
TLSConfig
()
if
err
!=
nil
{
return
err
}
client
:=
redis
.
NewClient
(
client
:=
redis
.
NewClient
(
&
redis
.
Options
{
&
redis
.
Options
{
Addr
:
address
,
Addr
:
address
,
Password
:
password
,
Password
:
password
,
Network
:
u
.
Scheme
,
Network
:
u
.
Scheme
,
PoolSize
:
1
,
PoolSize
:
1
,
TLSConfig
:
tlsConfig
,
},
},
)
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment