Skip to content

Commit

Permalink
Merge pull request #6 from signalfx/sfx-1.5.1
Browse files Browse the repository at this point in the history
Merge upstream 1.5.1 into SignalFx repo
  • Loading branch information
charless-splunk authored Jan 11, 2018
2 parents f055d7e + 7a8e7fe commit e875f44
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 17 deletions.
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
## v1.5.0.sfx0 [2018-01-08]
## v1.5.1.sfx0 [2018-01-12]

### Release Notes

- Rebase with upstream v1.5.0 release
- Rebase with upstream v1.5.1 release
- Fixed bug in SignalFx Utilization plugin where disk.summary_utilization was reported with out a hostname
- Distribute SignalFx metadata and process info collection across multiple go routines
- Batch metric output to SignalFx

## v1.5.1 [2017-01-10]

### Bugfixes

- [#3624](https://github.com/influxdata/telegraf/pull/3624): Fix name error in jolokia2_agent sample config.
- [#3625](https://github.com/influxdata/telegraf/pull/3625): Fix DC/OS login expiration time.
- [#3593](https://github.com/influxdata/telegraf/pull/3593): Set Content-Type charset in influxdb output and allow it be overridden.
- [#3594](https://github.com/influxdata/telegraf/pull/3594): Document permissions setup for postfix input.
- [#3633](https://github.com/influxdata/telegraf/pull/3633): Fix deliver_get field in rabbitmq input.
- [#3607](https://github.com/influxdata/telegraf/issues/3607): Escape environment variables during config toml parsing.

## v1.5 [2017-12-14]

Expand Down
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ docker-run:
-d cobaugh/openldap-alpine
docker run --name cratedb \
-p "6543:5432" \
-d crate crate \
-d crate:2.2 \
-Cnetwork.host=0.0.0.0 \
-Ctransport.host=localhost \
-Clicense.enterprise=false
Expand Down Expand Up @@ -116,12 +116,6 @@ docker-run-circle:
-e SLAPD_CONFIG_ROOTPW="secret" \
-p "389:389" -p "636:636" \
-d cobaugh/openldap-alpine
docker run --name cratedb \
-p "6543:5432" \
-d crate crate \
-Cnetwork.host=0.0.0.0 \
-Ctransport.host=localhost \
-Clicense.enterprise=false

docker-kill:
-docker kill aerospike elasticsearch kafka memcached mqtt mysql nats nsq \
Expand Down
2 changes: 1 addition & 1 deletion etc/telegraf.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1660,7 +1660,7 @@
# # insecure_skip_verify = false
#
# ## Add metrics to read
# [[inputs.jolokia2.metric]]
# [[inputs.jolokia2_agent.metric]]
# name = "java_runtime"
# mbean = "java.lang:type=Runtime"
# paths = ["Uptime"]
Expand Down
15 changes: 13 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ var (

// envVarRe is a regex to find environment variables in the config file
envVarRe = regexp.MustCompile(`\$\w+`)

envVarEscaper = strings.NewReplacer(
`"`, `\"`,
`\`, `\\`,
)
)

// Config specifies the URL/user/password for the database that telegraf
Expand Down Expand Up @@ -689,6 +694,11 @@ func trimBOM(f []byte) []byte {
return bytes.TrimPrefix(f, []byte("\xef\xbb\xbf"))
}

// escapeEnv escapes a value for inserting into a TOML string.
func escapeEnv(value string) string {
return envVarEscaper.Replace(value)
}

// parseFile loads a TOML configuration from a provided path and
// returns the AST produced from the TOML parser. When loading the file, it
// will find environment variables and replace them.
Expand All @@ -702,8 +712,9 @@ func parseFile(fpath string) (*ast.Table, error) {

env_vars := envVarRe.FindAll(contents, -1)
for _, env_var := range env_vars {
env_val := os.Getenv(strings.TrimPrefix(string(env_var), "$"))
if env_val != "" {
env_val, ok := os.LookupEnv(strings.TrimPrefix(string(env_var), "$"))
if ok {
env_val = escapeEnv(env_val)
contents = bytes.Replace(contents, env_var, []byte(env_val), 1)
}
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/bond/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Bond Input Plugin

The Bond Input plugin collects bond interface status, bond's slaves interfaces
The Bond Input plugin collects network bond interface status, bond's slaves interfaces
status and failures count of bond's slaves interfaces.
The plugin collects these metrics from `/proc/net/bonding/*` files.

Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/dcos/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ func (c *ClusterClient) createLoginToken(sa *ServiceAccount) (string, error) {
UID: sa.AccountID,
StandardClaims: jwt.StandardClaims{
// How long we have to login with this token
ExpiresAt: int64(5 * time.Minute / time.Second),
ExpiresAt: time.Now().Add(5 * time.Minute).Unix(),
},
})
return token.SignedString(sa.PrivateKey)
Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/jolokia2/jolokia_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (ja *JolokiaAgent) SampleConfig() string {
# insecure_skip_verify = false
## Add metrics to read
[[inputs.jolokia2.metric]]
[[inputs.jolokia2_agent.metric]]
name = "java_runtime"
mbean = "java.lang:type=Runtime"
paths = ["Uptime"]
Expand Down
2 changes: 2 additions & 0 deletions plugins/inputs/openldap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This plugin gathers metrics from OpenLDAP's cn=Monitor backend.

### Configuration:

To use this plugin you must enable the [monitoring](https://www.openldap.org/devel/admin/monitoringslapd.html) backend.

```toml
[[inputs.openldap]]
host = "localhost"
Expand Down
19 changes: 19 additions & 0 deletions plugins/inputs/postfix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,25 @@ For each of the active, hold, incoming, maildrop, and deferred queues (http://ww
# queue_directory = "/var/spool/postfix"
```

#### Permissions:

Telegraf will need read access to the files in the queue directory. You may
need to alter the permissions of these directories to provide access to the
telegraf user.

Unix permissions:
```sh
$ sudo chgrp -R telegraf /var/spool/postfix/{active,hold,incoming,deferred}
$ sudo chmod -R g+rXs /var/spool/postfix/{active,hold,incoming,deferred}
$ sudo usermod -a -G postdrop telegraf
$ sudo chmod g+r /var/spool/postfix/maildrop
```

Posix ACL:
```sh
$ sudo setfacl -Rdm u:telegraf:rX /var/spool/postfix/{active,hold,incoming,deferred,maildrop}
```

### Measurements & Fields:

- postfix_queue
Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/rabbitmq/rabbitmq.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type MessageStats struct {
AckDetails Details `json:"ack_details"`
Deliver int64
DeliverDetails Details `json:"deliver_details"`
DeliverGet int64
DeliverGet int64 `json:"deliver_get"`
DeliverGetDetails Details `json:"deliver_get_details"`
Publish int64
PublishDetails Details `json:"publish_details"`
Expand Down
8 changes: 8 additions & 0 deletions plugins/outputs/cratedb/cratedb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ func TestConnectAndWrite(t *testing.T) {
t.Skip("Skipping integration test in short mode")
}

if os.Getenv("CIRCLE_PROJECT_REPONAME") != "" {
t.Skip("Skipping test on CircleCI due to docker failures")
}

url := testURL()
table := "test"

Expand Down Expand Up @@ -95,6 +99,10 @@ func Test_escapeValue(t *testing.T) {
t.Skip("Skipping integration test in short mode")
}

if os.Getenv("CIRCLE_PROJECT_REPONAME") != "" {
t.Skip("Skipping test on CircleCI due to docker failures")
}

tests := []struct {
Val interface{}
Want string
Expand Down
3 changes: 2 additions & 1 deletion plugins/outputs/influxdb/client/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,12 @@ func (c *httpClient) makeRequest(uri string, body io.Reader) (*http.Request, err
return nil, err
}

req.Header.Set("Content-Type", "text/plain; charset=utf-8")

for header, value := range c.config.HTTPHeaders {
req.Header.Set(header, value)
}

req.Header.Set("Content-Type", "text/plain")
req.Header.Set("User-Agent", c.config.UserAgent)
if c.config.Username != "" && c.config.Password != "" {
req.SetBasicAuth(c.config.Username, c.config.Password)
Expand Down

0 comments on commit e875f44

Please sign in to comment.