Compare commits
6 Commits
1.7.0-rc2
...
output-inf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1989287606 | ||
|
|
5f0cbd1255 | ||
|
|
3ef4dff4ec | ||
|
|
dfe7b5eec2 | ||
|
|
92a8f795f5 | ||
|
|
b1d77ade55 |
@@ -1,3 +1,9 @@
|
|||||||
|
## v1.8 [unreleased]
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- [#4236](https://github.com/influxdata/telegraf/pull/4236): Add SSL/TLS support to redis input.
|
||||||
|
|
||||||
## v1.7 [unreleased]
|
## v1.7 [unreleased]
|
||||||
|
|
||||||
### Release Notes
|
### Release Notes
|
||||||
@@ -73,7 +79,6 @@
|
|||||||
- [#2879](https://github.com/influxdata/telegraf/issues/2879): Fix wildcards and multi instance processes in win_perf_counters.
|
- [#2879](https://github.com/influxdata/telegraf/issues/2879): Fix wildcards and multi instance processes in win_perf_counters.
|
||||||
- [#2468](https://github.com/influxdata/telegraf/issues/2468): Fix crash on 32-bit Windows in win_perf_counters.
|
- [#2468](https://github.com/influxdata/telegraf/issues/2468): Fix crash on 32-bit Windows in win_perf_counters.
|
||||||
- [#4198](https://github.com/influxdata/telegraf/issues/4198): Fix win_perf_counters not collecting at every interval.
|
- [#4198](https://github.com/influxdata/telegraf/issues/4198): Fix win_perf_counters not collecting at every interval.
|
||||||
- [#4227](https://github.com/influxdata/telegraf/issues/4227): Use same flags for all BSD family ping variants.
|
|
||||||
|
|
||||||
## v1.6.4 [2018-06-05]
|
## v1.6.4 [2018-06-05]
|
||||||
|
|
||||||
|
|||||||
4
Godeps
4
Godeps
@@ -28,13 +28,13 @@ 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
|
||||||
github.com/influxdata/go-syslog 84f3b60009444d298f97454feb1f20cf91d1fa6e
|
github.com/influxdata/go-syslog 84f3b60009444d298f97454feb1f20cf91d1fa6e
|
||||||
github.com/influxdata/tail c43482518d410361b6c383d7aebce33d0471d7bc
|
github.com/influxdata/tail c43482518d410361b6c383d7aebce33d0471d7bc
|
||||||
github.com/influxdata/toml 2a2e3012f7cfbef64091cc79776311e65dfa211b
|
github.com/influxdata/toml 5d1d907f22ead1cd47adde17ceec5bda9cacaf8f
|
||||||
github.com/influxdata/wlog 7c63b0a71ef8300adc255344d275e10e5c3a71ec
|
github.com/influxdata/wlog 7c63b0a71ef8300adc255344d275e10e5c3a71ec
|
||||||
github.com/fsnotify/fsnotify c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9
|
github.com/fsnotify/fsnotify c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9
|
||||||
github.com/jackc/pgx 63f58fd32edb5684b9e9f4cfaac847c6b42b3917
|
github.com/jackc/pgx 63f58fd32edb5684b9e9f4cfaac847c6b42b3917
|
||||||
|
|||||||
@@ -362,24 +362,6 @@ func (a *Agent) Run(shutdown chan struct{}) error {
|
|||||||
metricC := make(chan telegraf.Metric, 100)
|
metricC := make(chan telegraf.Metric, 100)
|
||||||
aggC := make(chan telegraf.Metric, 100)
|
aggC := make(chan telegraf.Metric, 100)
|
||||||
|
|
||||||
// Start all ServicePlugins
|
|
||||||
for _, input := range a.Config.Inputs {
|
|
||||||
input.SetDefaultTags(a.Config.Tags)
|
|
||||||
switch p := input.Input.(type) {
|
|
||||||
case telegraf.ServiceInput:
|
|
||||||
acc := NewAccumulator(input, metricC)
|
|
||||||
// Service input plugins should set their own precision of their
|
|
||||||
// metrics.
|
|
||||||
acc.SetPrecision(time.Nanosecond, 0)
|
|
||||||
if err := p.Start(acc); err != nil {
|
|
||||||
log.Printf("E! Service for input %s failed to start, exiting\n%s\n",
|
|
||||||
input.Name(), err.Error())
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer p.Stop()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Round collection to nearest interval by sleeping
|
// Round collection to nearest interval by sleeping
|
||||||
if a.Config.Agent.RoundInterval {
|
if a.Config.Agent.RoundInterval {
|
||||||
i := int64(a.Config.Agent.Interval.Duration)
|
i := int64(a.Config.Agent.Interval.Duration)
|
||||||
@@ -419,6 +401,25 @@ func (a *Agent) Run(shutdown chan struct{}) error {
|
|||||||
}(input, interval)
|
}(input, interval)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start all ServicePlugins inputs after all other
|
||||||
|
// plugins are loaded so that no metrics get dropped
|
||||||
|
for _, input := range a.Config.Inputs {
|
||||||
|
input.SetDefaultTags(a.Config.Tags)
|
||||||
|
switch p := input.Input.(type) {
|
||||||
|
case telegraf.ServiceInput:
|
||||||
|
acc := NewAccumulator(input, metricC)
|
||||||
|
// Service input plugins should set their own precision of their
|
||||||
|
// metrics.
|
||||||
|
acc.SetPrecision(time.Nanosecond, 0)
|
||||||
|
if err := p.Start(acc); err != nil {
|
||||||
|
log.Printf("E! Service for input %s failed to start, exiting\n%s\n",
|
||||||
|
input.Name(), err.Error())
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer p.Stop()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
a.Close()
|
a.Close()
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ var fService = flag.String("service", "",
|
|||||||
var fRunAsConsole = flag.Bool("console", false, "run as console application (windows only)")
|
var fRunAsConsole = flag.Bool("console", false, "run as console application (windows only)")
|
||||||
|
|
||||||
var (
|
var (
|
||||||
nextVersion = "1.7.0"
|
nextVersion = "1.8.0"
|
||||||
version string
|
version string
|
||||||
commit string
|
commit string
|
||||||
branch string
|
branch string
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/influxdata/telegraf"
|
"github.com/influxdata/telegraf"
|
||||||
@@ -153,6 +154,7 @@ func (r *RunningAggregator) Run(
|
|||||||
m.Time().After(r.periodEnd.Add(truncation).Add(r.Config.Delay)) {
|
m.Time().After(r.periodEnd.Add(truncation).Add(r.Config.Delay)) {
|
||||||
// the metric is outside the current aggregation period, so
|
// the metric is outside the current aggregation period, so
|
||||||
// skip it.
|
// skip it.
|
||||||
|
log.Printf("D! aggregator: metric \"%s\" is not in the current timewindow, skipping", m.Name())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
r.add(m)
|
r.add(m)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ type ClientConfig struct {
|
|||||||
// Deprecated in 1.7; use TLS variables above
|
// Deprecated in 1.7; use TLS variables above
|
||||||
SSLCA string `toml:"ssl_ca"`
|
SSLCA string `toml:"ssl_ca"`
|
||||||
SSLCert string `toml:"ssl_cert"`
|
SSLCert string `toml:"ssl_cert"`
|
||||||
SSLKey string `toml:"ssl_key"`
|
SSLKey string `toml:"ssl_ca"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServerConfig represents the standard server TLS config.
|
// ServerConfig represents the standard server TLS config.
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ To use this plugin you must enable the [monitoring](https://www.openldap.org/dev
|
|||||||
# ldaps, starttls, or no encryption. default is an empty string, disabling all encryption.
|
# ldaps, starttls, or no encryption. default is an empty string, disabling all encryption.
|
||||||
# note that port will likely need to be changed to 636 for ldaps
|
# note that port will likely need to be changed to 636 for ldaps
|
||||||
# valid options: "" | "starttls" | "ldaps"
|
# valid options: "" | "starttls" | "ldaps"
|
||||||
tls = ""
|
ssl = ""
|
||||||
|
|
||||||
# skip peer certificate verification. Default is false.
|
# skip peer certificate verification. Default is false.
|
||||||
insecure_skip_verify = false
|
insecure_skip_verify = false
|
||||||
|
|||||||
@@ -15,11 +15,9 @@ import (
|
|||||||
type Openldap struct {
|
type Openldap struct {
|
||||||
Host string
|
Host string
|
||||||
Port int
|
Port int
|
||||||
SSL string `toml:"ssl"` // Deprecated in 1.7; use TLS
|
Ssl string
|
||||||
TLS string `toml:"tls"`
|
|
||||||
InsecureSkipVerify bool
|
InsecureSkipVerify bool
|
||||||
SSLCA string `toml:"ssl_ca"` // Deprecated in 1.7; use TLSCA
|
SslCa string
|
||||||
TLSCA string `toml:"tls_ca"`
|
|
||||||
BindDn string
|
BindDn string
|
||||||
BindPassword string
|
BindPassword string
|
||||||
ReverseMetricNames bool
|
ReverseMetricNames bool
|
||||||
@@ -32,7 +30,7 @@ const sampleConfig string = `
|
|||||||
# ldaps, starttls, or no encryption. default is an empty string, disabling all encryption.
|
# ldaps, starttls, or no encryption. default is an empty string, disabling all encryption.
|
||||||
# note that port will likely need to be changed to 636 for ldaps
|
# note that port will likely need to be changed to 636 for ldaps
|
||||||
# valid options: "" | "starttls" | "ldaps"
|
# valid options: "" | "starttls" | "ldaps"
|
||||||
tls = ""
|
ssl = ""
|
||||||
|
|
||||||
# skip peer certificate verification. Default is false.
|
# skip peer certificate verification. Default is false.
|
||||||
insecure_skip_verify = false
|
insecure_skip_verify = false
|
||||||
@@ -72,11 +70,9 @@ func NewOpenldap() *Openldap {
|
|||||||
return &Openldap{
|
return &Openldap{
|
||||||
Host: "localhost",
|
Host: "localhost",
|
||||||
Port: 389,
|
Port: 389,
|
||||||
SSL: "",
|
Ssl: "",
|
||||||
TLS: "",
|
|
||||||
InsecureSkipVerify: false,
|
InsecureSkipVerify: false,
|
||||||
SSLCA: "",
|
SslCa: "",
|
||||||
TLSCA: "",
|
|
||||||
BindDn: "",
|
BindDn: "",
|
||||||
BindPassword: "",
|
BindPassword: "",
|
||||||
ReverseMetricNames: false,
|
ReverseMetricNames: false,
|
||||||
@@ -85,19 +81,12 @@ func NewOpenldap() *Openldap {
|
|||||||
|
|
||||||
// gather metrics
|
// gather metrics
|
||||||
func (o *Openldap) Gather(acc telegraf.Accumulator) error {
|
func (o *Openldap) Gather(acc telegraf.Accumulator) error {
|
||||||
if o.TLS == "" {
|
|
||||||
o.TLS = o.SSL
|
|
||||||
}
|
|
||||||
if o.TLSCA == "" {
|
|
||||||
o.TLSCA = o.SSLCA
|
|
||||||
}
|
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
var l *ldap.Conn
|
var l *ldap.Conn
|
||||||
if o.TLS != "" {
|
if o.Ssl != "" {
|
||||||
// build tls config
|
// build tls config
|
||||||
clientTLSConfig := tls.ClientConfig{
|
clientTLSConfig := tls.ClientConfig{
|
||||||
TLSCA: o.TLSCA,
|
SSLCA: o.SslCa,
|
||||||
InsecureSkipVerify: o.InsecureSkipVerify,
|
InsecureSkipVerify: o.InsecureSkipVerify,
|
||||||
}
|
}
|
||||||
tlsConfig, err := clientTLSConfig.TLSConfig()
|
tlsConfig, err := clientTLSConfig.TLSConfig()
|
||||||
@@ -105,13 +94,13 @@ func (o *Openldap) Gather(acc telegraf.Accumulator) error {
|
|||||||
acc.AddError(err)
|
acc.AddError(err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if o.TLS == "ldaps" {
|
if o.Ssl == "ldaps" {
|
||||||
l, err = ldap.DialTLS("tcp", fmt.Sprintf("%s:%d", o.Host, o.Port), tlsConfig)
|
l, err = ldap.DialTLS("tcp", fmt.Sprintf("%s:%d", o.Host, o.Port), tlsConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
acc.AddError(err)
|
acc.AddError(err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
} else if o.TLS == "starttls" {
|
} else if o.Ssl == "starttls" {
|
||||||
l, err = ldap.Dial("tcp", fmt.Sprintf("%s:%d", o.Host, o.Port))
|
l, err = ldap.Dial("tcp", fmt.Sprintf("%s:%d", o.Host, o.Port))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
acc.AddError(err)
|
acc.AddError(err)
|
||||||
@@ -119,7 +108,7 @@ func (o *Openldap) Gather(acc telegraf.Accumulator) error {
|
|||||||
}
|
}
|
||||||
err = l.StartTLS(tlsConfig)
|
err = l.StartTLS(tlsConfig)
|
||||||
} else {
|
} else {
|
||||||
acc.AddError(fmt.Errorf("Invalid setting for ssl: %s", o.TLS))
|
acc.AddError(fmt.Errorf("Invalid setting for ssl: %s", o.Ssl))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package openldap
|
package openldap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"gopkg.in/ldap.v2"
|
||||||
"strconv"
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"gopkg.in/ldap.v2"
|
|
||||||
|
|
||||||
"github.com/influxdata/telegraf/testutil"
|
"github.com/influxdata/telegraf/testutil"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
@@ -75,7 +74,7 @@ func TestOpenldapStartTLS(t *testing.T) {
|
|||||||
o := &Openldap{
|
o := &Openldap{
|
||||||
Host: testutil.GetLocalHost(),
|
Host: testutil.GetLocalHost(),
|
||||||
Port: 389,
|
Port: 389,
|
||||||
SSL: "starttls",
|
Ssl: "starttls",
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +92,7 @@ func TestOpenldapLDAPS(t *testing.T) {
|
|||||||
o := &Openldap{
|
o := &Openldap{
|
||||||
Host: testutil.GetLocalHost(),
|
Host: testutil.GetLocalHost(),
|
||||||
Port: 636,
|
Port: 636,
|
||||||
SSL: "ldaps",
|
Ssl: "ldaps",
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +110,7 @@ func TestOpenldapInvalidSSL(t *testing.T) {
|
|||||||
o := &Openldap{
|
o := &Openldap{
|
||||||
Host: testutil.GetLocalHost(),
|
Host: testutil.GetLocalHost(),
|
||||||
Port: 636,
|
Port: 636,
|
||||||
SSL: "invalid",
|
Ssl: "invalid",
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +129,7 @@ func TestOpenldapBind(t *testing.T) {
|
|||||||
o := &Openldap{
|
o := &Openldap{
|
||||||
Host: testutil.GetLocalHost(),
|
Host: testutil.GetLocalHost(),
|
||||||
Port: 389,
|
Port: 389,
|
||||||
SSL: "",
|
Ssl: "",
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
BindDn: "cn=manager,cn=config",
|
BindDn: "cn=manager,cn=config",
|
||||||
BindPassword: "secret",
|
BindPassword: "secret",
|
||||||
@@ -158,7 +157,7 @@ func TestOpenldapReverseMetrics(t *testing.T) {
|
|||||||
o := &Openldap{
|
o := &Openldap{
|
||||||
Host: testutil.GetLocalHost(),
|
Host: testutil.GetLocalHost(),
|
||||||
Port: 389,
|
Port: 389,
|
||||||
SSL: "",
|
Ssl: "",
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
BindDn: "cn=manager,cn=config",
|
BindDn: "cn=manager,cn=config",
|
||||||
BindPassword: "secret",
|
BindPassword: "secret",
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ func (p *Ping) args(url string) []string {
|
|||||||
}
|
}
|
||||||
if p.Timeout > 0 {
|
if p.Timeout > 0 {
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "darwin", "freebsd", "netbsd", "openbsd":
|
case "darwin":
|
||||||
args = append(args, "-W", strconv.FormatFloat(p.Timeout*1000, 'f', -1, 64))
|
args = append(args, "-W", strconv.FormatFloat(p.Timeout*1000, 'f', -1, 64))
|
||||||
case "linux":
|
case "linux":
|
||||||
args = append(args, "-W", strconv.FormatFloat(p.Timeout, 'f', -1, 64))
|
args = append(args, "-W", strconv.FormatFloat(p.Timeout, 'f', -1, 64))
|
||||||
@@ -186,7 +186,7 @@ func (p *Ping) args(url string) []string {
|
|||||||
}
|
}
|
||||||
if p.Deadline > 0 {
|
if p.Deadline > 0 {
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "darwin", "freebsd", "netbsd", "openbsd":
|
case "darwin":
|
||||||
args = append(args, "-t", strconv.Itoa(p.Deadline))
|
args = append(args, "-t", strconv.Itoa(p.Deadline))
|
||||||
case "linux":
|
case "linux":
|
||||||
args = append(args, "-w", strconv.Itoa(p.Deadline))
|
args = append(args, "-w", strconv.Itoa(p.Deadline))
|
||||||
@@ -197,10 +197,10 @@ func (p *Ping) args(url string) []string {
|
|||||||
}
|
}
|
||||||
if p.Interface != "" {
|
if p.Interface != "" {
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "darwin", "freebsd", "netbsd", "openbsd":
|
|
||||||
args = append(args, "-S", p.Interface)
|
|
||||||
case "linux":
|
case "linux":
|
||||||
args = append(args, "-I", p.Interface)
|
args = append(args, "-I", p.Interface)
|
||||||
|
case "freebsd", "darwin":
|
||||||
|
args = append(args, "-S", p.Interface)
|
||||||
default:
|
default:
|
||||||
// Not sure the best option here, just assume GNU ping?
|
// Not sure the best option here, just assume GNU ping?
|
||||||
args = append(args, "-I", p.Interface)
|
args = append(args, "-I", p.Interface)
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
@@ -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 = `
|
|||||||
## 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 {
|
|||||||
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,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -140,17 +140,17 @@ func (i *InfluxDB) Connect() error {
|
|||||||
i.serializer.SetFieldTypeSupport(influx.UintSupport)
|
i.serializer.SetFieldTypeSupport(influx.UintSupport)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, u := range urls {
|
for _, loc := range urls {
|
||||||
u, err := url.Parse(u)
|
u, err := url.Parse(loc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error parsing url [%s]: %v", u, err)
|
return fmt.Errorf("error parsing url [%q]: %v", loc, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var proxy *url.URL
|
var proxy *url.URL
|
||||||
if len(i.HTTPProxy) > 0 {
|
if len(i.HTTPProxy) > 0 {
|
||||||
proxy, err = url.Parse(i.HTTPProxy)
|
proxy, err = url.Parse(i.HTTPProxy)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error parsing proxy_url [%s]: %v", proxy, err)
|
return fmt.Errorf("error parsing proxy_url [%q]: %v", proxy, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ func (i *InfluxDB) Connect() error {
|
|||||||
|
|
||||||
i.clients = append(i.clients, c)
|
i.clients = append(i.clients, c)
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("unsupported scheme [%s]: %q", u, u.Scheme)
|
return fmt.Errorf("unsupported scheme [%q]: %q", u, u.Scheme)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,14 +209,14 @@ func (i *InfluxDB) Write(metrics []telegraf.Metric) error {
|
|||||||
if apiError.Type == DatabaseNotFound {
|
if apiError.Type == DatabaseNotFound {
|
||||||
err := client.CreateDatabase(ctx)
|
err := client.CreateDatabase(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("E! [outputs.influxdb] when writing to [%s]: database %q not found and failed to recreate",
|
log.Printf("E! [outputs.influxdb] when writing to [%q]: database %q not found and failed to recreate",
|
||||||
client.URL(), client.Database())
|
client.URL(), client.Database())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("E! [outputs.influxdb]: when writing to [%s]: %v", client.URL(), err)
|
log.Printf("E! [outputs.influxdb]: when writing to [%q]: %v", client.URL(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return errors.New("could not write any address")
|
return errors.New("could not write any address")
|
||||||
@@ -231,7 +231,7 @@ func (i *InfluxDB) udpClient(url *url.URL) (Client, error) {
|
|||||||
|
|
||||||
c, err := i.CreateUDPClientF(config)
|
c, err := i.CreateUDPClientF(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error creating UDP client [%s]: %v", url, err)
|
return nil, fmt.Errorf("error creating UDP client [%q]: %v", url, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return c, nil
|
return c, nil
|
||||||
@@ -261,13 +261,13 @@ func (i *InfluxDB) httpClient(ctx context.Context, url *url.URL, proxy *url.URL)
|
|||||||
|
|
||||||
c, err := i.CreateHTTPClientF(config)
|
c, err := i.CreateHTTPClientF(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error creating HTTP client [%s]: %v", url, err)
|
return nil, fmt.Errorf("error creating HTTP client [%q]: %v", url, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !i.SkipDatabaseCreation {
|
if !i.SkipDatabaseCreation {
|
||||||
err = c.CreateDatabase(ctx)
|
err = c.CreateDatabase(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("W! [outputs.influxdb] when writing to [%s]: database %q creation failed: %v",
|
log.Printf("W! [outputs.influxdb] when writing to [%q]: database %q creation failed: %v",
|
||||||
c.URL(), c.Database(), err)
|
c.URL(), c.Database(), err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ supported_packages = {
|
|||||||
"freebsd": [ "tar" ]
|
"freebsd": [ "tar" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
next_version = '1.7.0'
|
next_version = '1.8.0'
|
||||||
|
|
||||||
################
|
################
|
||||||
#### Telegraf Functions
|
#### Telegraf Functions
|
||||||
|
|||||||
Reference in New Issue
Block a user