From 0571eecb0c815dd71ce752d6256559206feb7b7d Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Fri, 18 Dec 2015 16:21:39 -0700 Subject: [PATCH] Remove 'Name' argument from influxdb plugin for 0.3.0 compatability closes #449 --- CHANGELOG.md | 1 + README.md | 1 + plugins/influxdb/README.md | 7 +++---- plugins/influxdb/influxdb.go | 12 ++++-------- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16e619d24..7f562c3ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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! diff --git a/README.md b/README.md index 1ae313df1..89c469926 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/plugins/influxdb/README.md b/plugins/influxdb/README.md index c55aa1fc8..8d4727973 100644 --- a/plugins/influxdb/README.md +++ b/plugins/influxdb/README.md @@ -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" @@ -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: diff --git a/plugins/influxdb/influxdb.go b/plugins/influxdb/influxdb.go index a261018ae..a4044364a 100644 --- a/plugins/influxdb/influxdb.go +++ b/plugins/influxdb/influxdb.go @@ -12,7 +12,6 @@ import ( ) type InfluxDB struct { - Name string URLs []string `toml:"urls"` } @@ -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 = [ @@ -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) } @@ -134,7 +130,7 @@ func (i *InfluxDB) gatherURL( p.Tags["url"] = url acc.AddFields( - i.Name+"_"+p.Name, + p.Name, p.Values, p.Tags, )