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
674c24f9
Commit
674c24f9
authored
7 years ago
by
Simone Rotondo
Committed by
Daniel Nelson
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add HTTP Proxy support to influxdb output (#2929)
parent
ca72df58
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
plugins/outputs/influxdb/README.md
+4
-0
4 additions, 0 deletions
plugins/outputs/influxdb/README.md
plugins/outputs/influxdb/client/http.go
+22
-4
22 additions, 4 deletions
plugins/outputs/influxdb/client/http.go
plugins/outputs/influxdb/influxdb.go
+6
-1
6 additions, 1 deletion
plugins/outputs/influxdb/influxdb.go
with
32 additions
and
5 deletions
plugins/outputs/influxdb/README.md
+
4
−
0
View file @
674c24f9
...
@@ -40,6 +40,9 @@ This plugin writes to [InfluxDB](https://www.influxdb.com) via HTTP or UDP.
...
@@ -40,6 +40,9 @@ This plugin writes to [InfluxDB](https://www.influxdb.com) via HTTP or UDP.
# ssl_key = "/etc/telegraf/key.pem"
# ssl_key = "/etc/telegraf/key.pem"
## Use SSL but skip chain & host verification
## Use SSL but skip chain & host verification
# insecure_skip_verify = false
# insecure_skip_verify = false
## HTTP Proxy Config
# http_proxy = "http://corporate.proxy:3128"
```
```
### Required parameters:
### Required parameters:
...
@@ -63,3 +66,4 @@ to write to. Each URL should start with either `http://` or `udp://`
...
@@ -63,3 +66,4 @@ to write to. Each URL should start with either `http://` or `udp://`
*
`ssl_cert`
: SSL CERT
*
`ssl_cert`
: SSL CERT
*
`ssl_key`
: SSL key
*
`ssl_key`
: SSL key
*
`insecure_skip_verify`
: Use SSL but skip chain & host verification (default: false)
*
`insecure_skip_verify`
: Use SSL but skip chain & host verification (default: false)
*
`http_proxy`
: HTTP Proxy URI
This diff is collapsed.
Click to expand it.
plugins/outputs/influxdb/client/http.go
+
22
−
4
View file @
674c24f9
...
@@ -39,15 +39,30 @@ func NewHTTP(config HTTPConfig, defaultWP WriteParams) (Client, error) {
...
@@ -39,15 +39,30 @@ func NewHTTP(config HTTPConfig, defaultWP WriteParams) (Client, error) {
return
nil
,
fmt
.
Errorf
(
"config.URL scheme must be http(s), got %s"
,
u
.
Scheme
)
return
nil
,
fmt
.
Errorf
(
"config.URL scheme must be http(s), got %s"
,
u
.
Scheme
)
}
}
var
transport
http
.
Transport
if
len
(
config
.
HTTPProxy
)
>
0
{
proxyURL
,
err
:=
url
.
Parse
(
config
.
HTTPProxy
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"error parsing config.HTTPProxy: %s"
,
err
)
}
transport
=
http
.
Transport
{
Proxy
:
http
.
ProxyURL
(
proxyURL
),
TLSClientConfig
:
config
.
TLSConfig
,
}
}
else
{
transport
=
http
.
Transport
{
TLSClientConfig
:
config
.
TLSConfig
,
}
}
return
&
httpClient
{
return
&
httpClient
{
writeURL
:
writeURL
(
u
,
defaultWP
),
writeURL
:
writeURL
(
u
,
defaultWP
),
config
:
config
,
config
:
config
,
url
:
u
,
url
:
u
,
client
:
&
http
.
Client
{
client
:
&
http
.
Client
{
Timeout
:
config
.
Timeout
,
Timeout
:
config
.
Timeout
,
Transport
:
&
http
.
Transport
{
Transport
:
&
transport
,
TLSClientConfig
:
config
.
TLSConfig
,
},
},
},
},
nil
},
nil
}
}
...
@@ -76,6 +91,9 @@ type HTTPConfig struct {
...
@@ -76,6 +91,9 @@ type HTTPConfig struct {
// TLSConfig is the tls auth settings to use for each request.
// TLSConfig is the tls auth settings to use for each request.
TLSConfig
*
tls
.
Config
TLSConfig
*
tls
.
Config
// Proxy URL should be of the form "http://host:port"
HTTPProxy
string
// Gzip, if true, compresses each payload using gzip.
// Gzip, if true, compresses each payload using gzip.
// TODO
// TODO
// Gzip bool
// Gzip bool
...
...
This diff is collapsed.
Click to expand it.
plugins/outputs/influxdb/influxdb.go
+
6
−
1
View file @
674c24f9
...
@@ -32,7 +32,8 @@ type InfluxDB struct {
...
@@ -32,7 +32,8 @@ type InfluxDB struct {
RetentionPolicy
string
RetentionPolicy
string
WriteConsistency
string
WriteConsistency
string
Timeout
internal
.
Duration
Timeout
internal
.
Duration
UDPPayload
int
`toml:"udp_payload"`
UDPPayload
int
`toml:"udp_payload"`
HTTPProxy
string
`toml:"http_proxy"`
// Path to CA file
// Path to CA file
SSLCA
string
`toml:"ssl_ca"`
SSLCA
string
`toml:"ssl_ca"`
...
@@ -83,6 +84,9 @@ var sampleConfig = `
...
@@ -83,6 +84,9 @@ var sampleConfig = `
# ssl_key = "/etc/telegraf/key.pem"
# ssl_key = "/etc/telegraf/key.pem"
## Use SSL but skip chain & host verification
## Use SSL but skip chain & host verification
# insecure_skip_verify = false
# insecure_skip_verify = false
## HTTP Proxy Config
# http_proxy = "http://corporate.proxy:3128"
`
`
// Connect initiates the primary connection to the range of provided URLs
// Connect initiates the primary connection to the range of provided URLs
...
@@ -123,6 +127,7 @@ func (i *InfluxDB) Connect() error {
...
@@ -123,6 +127,7 @@ func (i *InfluxDB) Connect() error {
UserAgent
:
i
.
UserAgent
,
UserAgent
:
i
.
UserAgent
,
Username
:
i
.
Username
,
Username
:
i
.
Username
,
Password
:
i
.
Password
,
Password
:
i
.
Password
,
HTTPProxy
:
i
.
HTTPProxy
,
}
}
wp
:=
client
.
WriteParams
{
wp
:=
client
.
WriteParams
{
Database
:
i
.
Database
,
Database
:
i
.
Database
,
...
...
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