Skip to content

Commit

Permalink
Merge tag '1.6.3' into signalfx-integration
Browse files Browse the repository at this point in the history
Telegraf 1.6.3
  • Loading branch information
charless-splunk committed Jun 4, 2018
2 parents 5e2b7d1 + 890f1d3 commit 1d080fe
Show file tree
Hide file tree
Showing 42 changed files with 10,378 additions and 8,662 deletions.
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,42 @@
### Release Notes

- SignalFx Packaging for Telegraf 1.6.0
## v1.6.3 [2018-05-21]

### Bugfixes

- [#4127](https://github.com/influxdata/telegraf/issues/4127): Fix intermittent panic in aerospike input.
- [#4130](https://github.com/influxdata/telegraf/issues/4130): Fix connection leak in jolokia2_agent.
- [#4136](https://github.com/influxdata/telegraf/pull/4130): Fix jolokia2 timeout parsing.
- [#4142](https://github.com/influxdata/telegraf/pull/4142): Fix error parsing dropwizard metrics.
- [#4149](https://github.com/influxdata/telegraf/issues/4149): Fix librato output support for uint and bool.
- [#4176](https://github.com/influxdata/telegraf/pull/4176): Fix waitgroup deadlock if url is incorrect in apache input.

## v1.6.2 [2018-05-08]

### Bugfixes

- [#4078](https://github.com/influxdata/telegraf/pull/4078): Use same timestamp for fields in system input.
- [#4091](https://github.com/influxdata/telegraf/pull/4091): Fix handling of uint64 in datadog output.
- [#4099](https://github.com/influxdata/telegraf/pull/4099): Ignore UTF8 BOM in JSON parser.
- [#4104](https://github.com/influxdata/telegraf/issues/4104): Fix case for slave metrics in mysql input.
- [#4110](https://github.com/influxdata/telegraf/issues/4110): Fix uint support in cratedb output.

## v1.6.1 [2018-04-23]

### Bugfixes
- [#3835](https://github.com/influxdata/telegraf/pull/3835): Report mem input fields as gauges instead counters.

- [#3835](https://github.com/influxdata/telegraf/issues/3835): Report mem input fields as gauges instead counters.
- [#4030](https://github.com/influxdata/telegraf/issues/4030): Fix graphite outputs unsigned integers in wrong format.
- [#4043](https://github.com/influxdata/telegraf/issues/4043): Report available fields if utmp is unreadable.
- [#4039](https://github.com/influxdata/telegraf/issues/4039): Fix potential "no fields" error writing to outputs.
- [#4037](https://github.com/influxdata/telegraf/issues/4037): Fix uptime reporting in system input when ran inside docker.
- [#3750](https://github.com/influxdata/telegraf/issues/3750): Fix mem input "cannot allocate memory" error on FreeBSD based systems.
- [#4056](https://github.com/influxdata/telegraf/pull/4056): Fix duplicate tags when overriding an existing tag.
- [#4062](https://github.com/influxdata/telegraf/pull/4062): Add server argument as first argument in unbound input.
- [#4063](https://github.com/influxdata/telegraf/issues/4063): Fix handling of floats with multiple leading zeroes.
- [#4064](https://github.com/influxdata/telegraf/issues/4064): Return errors in mongodb SSL/TLS configuration.

## v1.6 [2018-04-16]

Expand Down
4 changes: 2 additions & 2 deletions Godeps
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
collectd.org 2ce144541b8903101fb8f1483cc0497a68798122
github.com/aerospike/aerospike-client-go 95e1ad7791bdbca44707fedbb29be42024900d9c
github.com/aerospike/aerospike-client-go 9701404f4c60a6ea256595d24bf318f721a7e8b8
github.com/amir/raidman c74861fe6a7bb8ede0a010ce4485bdbb4fc4c985
github.com/apache/thrift 4aaa92ece8503a6da9bc6701604f69acf2b99d07
github.com/aws/aws-sdk-go c861d27d0304a79f727e9a8a4e2ac1e74602fdc0
Expand Down Expand Up @@ -66,7 +66,7 @@ github.com/prometheus/procfs 1878d9fbb537119d24b21ca07effd591627cd160
github.com/rcrowley/go-metrics 1f30fe9094a513ce4c700b9a54458bbb0c96996c
github.com/samuel/go-zookeeper 1d7be4effb13d2d908342d349d71a284a7542693
github.com/satori/go.uuid 5bf94b69c6b68ee1b541973bb8e1144db23a194b
github.com/shirou/gopsutil fc04d2dd9a512906a2604242b35275179e250eda
github.com/shirou/gopsutil c95755e4bcd7a62bb8bd33f3a597a7c7f35e2cf3
github.com/shirou/w32 3c9377fc6748f222729a8270fe2775d149a249ad
github.com/Shopify/sarama 3b1b38866a79f06deddf0487d5c27ba0697ccd65
github.com/Sirupsen/logrus 61e43dc76f7ee59a82bdf3d71033dc12bea4c77d
Expand Down
24 changes: 12 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ services:
- "389:389"
- "636:636"
crate:
image: crate/crate
ports:
- "4200:4200"
- "4230:4230"
command:
- crate
- -Cnetwork.host=0.0.0.0
- -Ctransport.host=localhost
- -Clicense.enterprise=false
environment:
- CRATE_HEAP_SIZE=128m
- JAVA_OPTS='-Xms256m -Xmx256m'
image: crate/crate
ports:
- "4200:4200"
- "4230:4230"
- "5432:5432"
command:
- crate
- -Cnetwork.host=0.0.0.0
- -Ctransport.host=localhost
- -Clicense.enterprise=false
environment:
- CRATE_HEAP_SIZE=128m
1 change: 0 additions & 1 deletion etc/telegraf.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3017,7 +3017,6 @@
# # watch_method = "inotify"
#
# ## Parse logstash-style "grok" patterns:
# ## Telegraf built-in parsing patterns: https://goo.gl/dkay10
# [inputs.logparser.grok]
# ## This is a list of patterns to check the given log file(s) for.
# ## Note that adding patterns here increases processing time. The most
Expand Down
2 changes: 2 additions & 0 deletions metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ type Metric interface {
AddField(key string, value interface{})
RemoveField(key string)

SetTime(t time.Time)

// HashID returns an unique identifier for the series.
HashID() uint64

Expand Down
5 changes: 5 additions & 0 deletions metric/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func (m *metric) AddTag(key, value string) {

if key == tag.Key {
tag.Value = value
return
}

m.tags = append(m.tags, nil)
Expand Down Expand Up @@ -201,6 +202,10 @@ func (m *metric) RemoveField(key string) {
}
}

func (m *metric) SetTime(t time.Time) {
m.tm = t
}

func (m *metric) Copy() telegraf.Metric {
m2 := &metric{
name: m.name,
Expand Down
1 change: 1 addition & 0 deletions metric/metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func TestAddTagOverwrites(t *testing.T) {
value, ok := m.GetTag("host")
require.True(t, ok)
require.Equal(t, "example.org", value)
require.Equal(t, 1, len(m.TagList()))
}

func TestRemoveTagNoEffectOnMissingTags(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions plugins/inputs/apache/apache.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ func (n *Apache) Description() string {
}

func (n *Apache) Gather(acc telegraf.Accumulator) error {
var wg sync.WaitGroup

if len(n.Urls) == 0 {
n.Urls = []string{"http://localhost/server-status?auto"}
}
Expand All @@ -78,15 +80,14 @@ func (n *Apache) Gather(acc telegraf.Accumulator) error {
n.client = client
}

var wg sync.WaitGroup
wg.Add(len(n.Urls))
for _, u := range n.Urls {
addr, err := url.Parse(u)
if err != nil {
acc.AddError(fmt.Errorf("Unable to parse address '%s': %s", u, err))
continue
}

wg.Add(1)
go func(addr *url.URL) {
defer wg.Done()
acc.AddError(n.gatherUrl(addr, acc))
Expand Down
10 changes: 6 additions & 4 deletions plugins/inputs/cassandra/cassandra.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs"
"io/ioutil"
"net/http"
"net/url"
"strings"

"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs"
)

type JolokiaClient interface {
Expand Down Expand Up @@ -60,7 +61,8 @@ func newCassandraMetric(host string, metric string,
func addValuesAsFields(values map[string]interface{}, fields map[string]interface{},
mname string) {
for k, v := range values {
if v != nil {
switch v.(type) {
case int64, float64, string, bool:
fields[mname+"_"+k] = v
}
}
Expand Down Expand Up @@ -117,7 +119,7 @@ func (j javaMetric) addTagsFields(out map[string]interface{}) {
switch t := values.(type) {
case map[string]interface{}:
addValuesAsFields(values.(map[string]interface{}), fields, attribute)
case interface{}:
case int64, float64, string, bool:
fields[attribute] = t
}
j.acc.AddFields(tokens["class"]+tokens["type"], fields, tags)
Expand Down
30 changes: 19 additions & 11 deletions plugins/inputs/jolokia2/jolokia_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package jolokia2
import (
"fmt"
"sync"
"time"

"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal"
)

type JolokiaAgent struct {
Expand All @@ -16,7 +16,7 @@ type JolokiaAgent struct {
URLs []string `toml:"urls"`
Username string
Password string
ResponseTimeout time.Duration `toml:"response_timeout"`
ResponseTimeout internal.Duration `toml:"response_timeout"`

SSLCA string `toml:"ssl_ca"`
SSLCert string `toml:"ssl_cert"`
Expand All @@ -25,6 +25,7 @@ type JolokiaAgent struct {

Metrics []MetricConfig `toml:"metric"`
gatherer *Gatherer
clients []*Client
}

func (ja *JolokiaAgent) SampleConfig() string {
Expand Down Expand Up @@ -62,20 +63,27 @@ func (ja *JolokiaAgent) Gather(acc telegraf.Accumulator) error {
ja.gatherer = NewGatherer(ja.createMetrics())
}

var wg sync.WaitGroup

for _, url := range ja.URLs {
client, err := ja.createClient(url)
if err != nil {
acc.AddError(fmt.Errorf("Unable to create client for %s: %v", url, err))
continue
// Initialize clients once
if ja.clients == nil {
ja.clients = make([]*Client, 0, len(ja.URLs))
for _, url := range ja.URLs {
client, err := ja.createClient(url)
if err != nil {
acc.AddError(fmt.Errorf("Unable to create client for %s: %v", url, err))
continue
}
ja.clients = append(ja.clients, client)
}
}

var wg sync.WaitGroup

for _, client := range ja.clients {
wg.Add(1)
go func(client *Client) {
defer wg.Done()

err = ja.gatherer.Gather(client, acc)
err := ja.gatherer.Gather(client, acc)
if err != nil {
acc.AddError(fmt.Errorf("Unable to gather metrics for %s: %v", client.URL, err))
}
Expand Down Expand Up @@ -103,7 +111,7 @@ func (ja *JolokiaAgent) createClient(url string) (*Client, error) {
return NewClient(url, &ClientConfig{
Username: ja.Username,
Password: ja.Password,
ResponseTimeout: ja.ResponseTimeout,
ResponseTimeout: ja.ResponseTimeout.Duration,
SSLCA: ja.SSLCA,
SSLCert: ja.SSLCert,
SSLKey: ja.SSLKey,
Expand Down
7 changes: 3 additions & 4 deletions plugins/inputs/jolokia2/jolokia_proxy.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package jolokia2

import (
"time"

"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal"
)

type JolokiaProxy struct {
Expand All @@ -22,7 +21,7 @@ type JolokiaProxy struct {
SSLCert string `toml:"ssl_cert"`
SSLKey string `toml:"ssl_key"`
InsecureSkipVerify bool
ResponseTimeout time.Duration `toml:"response_timeout"`
ResponseTimeout internal.Duration `toml:"response_timeout"`

Metrics []MetricConfig `toml:"metric"`
client *Client
Expand Down Expand Up @@ -119,7 +118,7 @@ func (jp *JolokiaProxy) createClient() (*Client, error) {
return NewClient(jp.URL, &ClientConfig{
Username: jp.Username,
Password: jp.Password,
ResponseTimeout: jp.ResponseTimeout,
ResponseTimeout: jp.ResponseTimeout.Duration,
SSLCA: jp.SSLCA,
SSLCert: jp.SSLCert,
SSLKey: jp.SSLKey,
Expand Down
1 change: 0 additions & 1 deletion plugins/inputs/logparser/logparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ const sampleConfig = `
# watch_method = "inotify"
## Parse logstash-style "grok" patterns:
## Telegraf built-in parsing patterns: https://goo.gl/dkay10
[inputs.logparser.grok]
## This is a list of patterns to check the given log file(s) for.
## Note that adding patterns here increases processing time. The most
Expand Down
3 changes: 3 additions & 0 deletions plugins/inputs/mongodb/mongodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ func (m *MongoDB) gatherServer(server *Server, acc telegraf.Accumulator) error {
} else {
tlsConfig, err = internal.GetTLSConfig(
m.SSLCert, m.SSLKey, m.SSLCA, m.InsecureSkipVerify)
if err != nil {
return err
}
}

// If configured to use TLS, add a dial function
Expand Down
4 changes: 2 additions & 2 deletions plugins/inputs/mysql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ style concurrently:
servers = ["tcp(127.0.0.1:3306)/"]

[[inputs.mysql]]
name_override = "_2"
name_suffix = "_v2"
metric_version = 2

servers = ["tcp(127.0.0.1:3306)/"]
Expand All @@ -141,7 +141,7 @@ measurement name.
metric_version = 2

[[inputs.mysql]]
name_override = "_2"
name_suffix = "_v2"
metric_version = 2

servers = ["tcp(127.0.0.1:3306)/"]
Expand Down
4 changes: 3 additions & 1 deletion plugins/inputs/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,9 @@ func (m *Mysql) gatherSlaveStatuses(db *sql.DB, serv string, acc telegraf.Accumu
}
// range over columns, and try to parse values
for i, col := range cols {
col = strings.ToLower(col)
if m.MetricVersion >= 2 {
col = strings.ToLower(col)
}
if value, ok := m.parseValue(*vals[i].(*sql.RawBytes)); ok {
fields["slave_"+col] = value
}
Expand Down
37 changes: 17 additions & 20 deletions plugins/inputs/system/SYSTEM_README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# System Input Plugin

The system plugin gathers general stats on system load, uptime,
and number of users logged in. It is basically equivalent
to the unix `uptime` command.
and number of users logged in. It is similar to the unix `uptime` command.

### Configuration:

Expand All @@ -11,29 +10,27 @@ to the unix `uptime` command.
[[inputs.system]]
# no configuration
```
#### Permissions:

### Measurements & Fields:
The `n_users` field requires read access to `/var/run/utmp`, and may require
the `telegraf` user to be added to the `utmp` group on some systems.

- system
- load1 (float)
- load15 (float)
- load5 (float)
- n_users (integer)
- n_cpus (integer)
- uptime (integer, seconds)
- uptime_format (string)

### Tags:
### Metrics:

None
- system
- fields:
- load1 (float)
- load15 (float)
- load5 (float)
- n_users (integer)
- n_cpus (integer)
- uptime (integer, seconds)
- uptime_format (string)

### Example Output:

```
$ telegraf --config ~/ws/telegraf.conf --input-filter system --test
* Plugin: system, Collection 1
* Plugin: inputs.system, Collection 1
> system,host=tyrion load1=3.72,load5=2.4,load15=2.1,n_users=3i,n_cpus=4i 1483964144000000000
> system,host=tyrion uptime=1249632i 1483964144000000000
> system,host=tyrion uptime_format="14 days, 11:07" 1483964144000000000
system,host=tyrion load1=3.72,load5=2.4,load15=2.1,n_users=3i,n_cpus=4i 1483964144000000000
system,host=tyrion uptime=1249632i 1483964144000000000
system,host=tyrion uptime_format="14 days, 11:07" 1483964144000000000
```
Loading

0 comments on commit 1d080fe

Please sign in to comment.