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
e8fc3ca7
Unverified
Commit
e8fc3ca7
authored
7 years ago
by
Daniel Nelson
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add TLS support to kapacitor input (#3927)
parent
729388f4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
plugins/inputs/kapacitor/README.md
+7
-0
7 additions, 0 deletions
plugins/inputs/kapacitor/README.md
plugins/inputs/kapacitor/kapacitor.go
+38
-1
38 additions, 1 deletion
plugins/inputs/kapacitor/kapacitor.go
with
45 additions
and
1 deletion
plugins/inputs/kapacitor/README.md
+
7
−
0
View file @
e8fc3ca7
...
@@ -14,6 +14,13 @@ The Kapacitor plugin will collect metrics from the given Kapacitor instances.
...
@@ -14,6 +14,13 @@ The Kapacitor plugin will collect metrics from the given Kapacitor instances.
## Time limit for http requests
## Time limit for http requests
timeout
=
"5s"
timeout
=
"5s"
## Optional SSL Config
# ssl_ca = "/etc/telegraf/ca.pem"
# ssl_cert = "/etc/telegraf/cert.pem"
# ssl_key = "/etc/telegraf/key.pem"
## Use SSL but skip chain & host verification
# insecure_skip_verify = false
```
```
### Measurements & Fields
### Measurements & Fields
...
...
This diff is collapsed.
Click to expand it.
plugins/inputs/kapacitor/kapacitor.go
+
38
−
1
View file @
e8fc3ca7
...
@@ -21,6 +21,15 @@ type Kapacitor struct {
...
@@ -21,6 +21,15 @@ type Kapacitor struct {
Timeout
internal
.
Duration
Timeout
internal
.
Duration
// Path to CA file
SSLCA
string
`toml:"ssl_ca"`
// Path to host cert file
SSLCert
string
`toml:"ssl_cert"`
// Path to cert key file
SSLKey
string
`toml:"ssl_key"`
// Use SSL but skip chain & host verification
InsecureSkipVerify
bool
client
*
http
.
Client
client
*
http
.
Client
}
}
...
@@ -38,12 +47,23 @@ func (*Kapacitor) SampleConfig() string {
...
@@ -38,12 +47,23 @@ func (*Kapacitor) SampleConfig() string {
## Time limit for http requests
## Time limit for http requests
timeout = "5s"
timeout = "5s"
## Optional SSL Config
# ssl_ca = "/etc/telegraf/ca.pem"
# ssl_cert = "/etc/telegraf/cert.pem"
# ssl_key = "/etc/telegraf/key.pem"
## Use SSL but skip chain & host verification
# insecure_skip_verify = false
`
`
}
}
func
(
k
*
Kapacitor
)
Gather
(
acc
telegraf
.
Accumulator
)
error
{
func
(
k
*
Kapacitor
)
Gather
(
acc
telegraf
.
Accumulator
)
error
{
if
k
.
client
==
nil
{
if
k
.
client
==
nil
{
k
.
client
=
&
http
.
Client
{
Timeout
:
k
.
Timeout
.
Duration
}
client
,
err
:=
k
.
createHttpClient
()
if
err
!=
nil
{
return
err
}
k
.
client
=
client
}
}
var
wg
sync
.
WaitGroup
var
wg
sync
.
WaitGroup
...
@@ -61,6 +81,23 @@ func (k *Kapacitor) Gather(acc telegraf.Accumulator) error {
...
@@ -61,6 +81,23 @@ func (k *Kapacitor) Gather(acc telegraf.Accumulator) error {
return
nil
return
nil
}
}
func
(
k
*
Kapacitor
)
createHttpClient
()
(
*
http
.
Client
,
error
)
{
tlsCfg
,
err
:=
internal
.
GetTLSConfig
(
k
.
SSLCert
,
k
.
SSLKey
,
k
.
SSLCA
,
k
.
InsecureSkipVerify
)
if
err
!=
nil
{
return
nil
,
err
}
client
:=
&
http
.
Client
{
Transport
:
&
http
.
Transport
{
TLSClientConfig
:
tlsCfg
,
},
Timeout
:
k
.
Timeout
.
Duration
,
}
return
client
,
nil
}
type
object
struct
{
type
object
struct
{
Name
string
`json:"name"`
Name
string
`json:"name"`
Values
map
[
string
]
interface
{}
`json:"values"`
Values
map
[
string
]
interface
{}
`json:"values"`
...
...
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