Skip to content

Commit

Permalink
Remove 'Name' argument from influxdb plugin for 0.3.0 compatability
Browse files Browse the repository at this point in the history
closes #449
  • Loading branch information
sparrc committed Dec 18, 2015
1 parent 4f3d6dd commit 0571eec
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Features
- [#427](https://github.com/influxdb/telegraf/pull/427): zfs plugin: pool stats added. Thanks @allenpetersen!
- [#428](https://github.com/influxdb/telegraf/pull/428): Amazon Kinesis output. Thanks @jimmystewpot!
- [#449](https://github.com/influxdb/telegraf/pull/449): influxdb plugin, thanks @mark-rushakoff

### Bugfixes
- [#430](https://github.com/influxdb/telegraf/issues/430): Network statistics removed in elasticsearch 2.1. Thanks @jipperinbham!
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ Telegraf currently has support for collecting metrics from:
* exec (generic JSON-emitting executable plugin)
* haproxy
* httpjson (generic JSON-emitting http service plugin)
* influxdb
* jolokia (remote JMX with JSON over HTTP)
* leofs
* lustre2
Expand Down
7 changes: 3 additions & 4 deletions plugins/influxdb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ With a configuration of:

```toml
[[plugins.influxdb]]
name = "produce"
urls = [
"http://127.0.0.1:8086/debug/vars",
"http://192.168.2.1:8086/debug/vars"
Expand Down Expand Up @@ -58,10 +57,10 @@ And if 192.168.2.1 responds like so:
Then the collected metrics will be:

```
influxdb_produce_fruit,url='http://127.0.0.1:8086/debug/vars',kind='apple' inventory=371.0,sold=112.0
influxdb_produce_fruit,url='http://127.0.0.1:8086/debug/vars',kind='banana' inventory=1000.0,sold=403.0
influxdb_fruit,url='http://127.0.0.1:8086/debug/vars',kind='apple' inventory=371.0,sold=112.0
influxdb_fruit,url='http://127.0.0.1:8086/debug/vars',kind='banana' inventory=1000.0,sold=403.0
influxdb_produce_transactions,url='http://192.168.2.1:8086/debug/vars' total=100.0,balance=184.75
influxdb_transactions,url='http://192.168.2.1:8086/debug/vars' total=100.0,balance=184.75
```

There are two important details to note about the collected metrics:
Expand Down
12 changes: 4 additions & 8 deletions plugins/influxdb/influxdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
)

type InfluxDB struct {
Name string
URLs []string `toml:"urls"`
}

Expand All @@ -22,12 +21,9 @@ func (*InfluxDB) Description() string {

func (*InfluxDB) SampleConfig() string {
return `
# Reads InfluxDB-formatted JSON from given URLs.
# Works with InfluxDB debug endpoints out of the box, but other services can use this format too.
# Works with InfluxDB debug endpoints out of the box,
# but other services can use this format too.
# See the influxdb plugin's README for more details.
[[plugins.influxdb]]
# Name to use for measurement
name = "influxdb"
# Multiple URLs from which to read InfluxDB-formatted JSON
urls = [
Expand All @@ -45,7 +41,7 @@ func (i *InfluxDB) Gather(acc plugins.Accumulator) error {
go func(url string) {
defer wg.Done()
if err := i.gatherURL(acc, url); err != nil {
errorChannel <- fmt.Errorf("[name=%s][url=%s]: %s", i.Name, url, err)
errorChannel <- fmt.Errorf("[url=%s]: %s", url, err)
}
}(u)
}
Expand Down Expand Up @@ -134,7 +130,7 @@ func (i *InfluxDB) gatherURL(
p.Tags["url"] = url

acc.AddFields(
i.Name+"_"+p.Name,
p.Name,
p.Values,
p.Tags,
)
Expand Down

0 comments on commit 0571eec

Please sign in to comment.