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
4e2fe598
Commit
4e2fe598
authored
8 years ago
by
Seuf
Committed by
Daniel Nelson
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Added SSL configuration for input haproxy (#2723)
parent
5fe5c46c
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
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
plugins/inputs/haproxy/README.md
+6
-0
6 additions, 0 deletions
plugins/inputs/haproxy/README.md
plugins/inputs/haproxy/haproxy.go
+26
-1
26 additions, 1 deletion
plugins/inputs/haproxy/haproxy.go
with
33 additions
and
1 deletion
CHANGELOG.md
+
1
−
0
View file @
4e2fe598
...
...
@@ -41,6 +41,7 @@ be deprecated eventually.
### Features
-
[
#2723
](
https://github.com/influxdata/telegraf/pull/2723
)
: Added SSL configuration for input haproxy.
-
[
#2494
](
https://github.com/influxdata/telegraf/pull/2494
)
: Add interrupts input plugin.
-
[
#2094
](
https://github.com/influxdata/telegraf/pull/2094
)
: Add generic socket listener & writer.
-
[
#2204
](
https://github.com/influxdata/telegraf/pull/2204
)
: Extend http_response to support searching for a substring in response. Return 1 if found, else 0.
...
...
This diff is collapsed.
Click to expand it.
plugins/inputs/haproxy/README.md
+
6
−
0
View file @
4e2fe598
...
...
@@ -8,6 +8,12 @@
# SampleConfig
[[inputs.haproxy]]
servers
=
[
"http://1.2.3.4/haproxy?stats"
,
"/var/run/haproxy*.sock"
]
# 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
```
#### `servers`
...
...
This diff is collapsed.
Click to expand it.
plugins/inputs/haproxy/haproxy.go
+
26
−
1
View file @
4e2fe598
...
...
@@ -14,6 +14,7 @@ import (
"time"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal"
"github.com/influxdata/telegraf/plugins/inputs"
)
...
...
@@ -25,6 +26,15 @@ type haproxy struct {
client
*
http
.
Client
KeepFieldNames
bool
// 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
}
var
sampleConfig
=
`
...
...
@@ -45,6 +55,13 @@ var sampleConfig = `
## Setting this option to true results in the plugin keeping the original
## field names.
## keep_field_names = true
## 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
(
r
*
haproxy
)
SampleConfig
()
string
{
...
...
@@ -127,7 +144,15 @@ func (g *haproxy) gatherServer(addr string, acc telegraf.Accumulator) error {
}
if
g
.
client
==
nil
{
tr
:=
&
http
.
Transport
{
ResponseHeaderTimeout
:
time
.
Duration
(
3
*
time
.
Second
)}
tlsCfg
,
err
:=
internal
.
GetTLSConfig
(
g
.
SSLCert
,
g
.
SSLKey
,
g
.
SSLCA
,
g
.
InsecureSkipVerify
)
if
err
!=
nil
{
return
err
}
tr
:=
&
http
.
Transport
{
ResponseHeaderTimeout
:
time
.
Duration
(
3
*
time
.
Second
),
TLSClientConfig
:
tlsCfg
,
}
client
:=
&
http
.
Client
{
Transport
:
tr
,
Timeout
:
time
.
Duration
(
4
*
time
.
Second
),
...
...
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