From 5664625f67fb1d3f0a64c7a491aca9536c2a8a08 Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Mon, 16 Nov 2015 10:43:03 -0700 Subject: [PATCH] Update README, CHANGELOG, and unit tests with list output --- CHANGELOG.md | 3 +++ README.md | 2 +- agent_test.go | 10 +++++----- etc/config.sample.toml | 2 +- testdata/telegraf-agent.toml | 8 ++++++-- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fcc72fac..1f5bf3856 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ changed to just run docker commands in the Makefile. See `make docker-run` and - HAProxy plugin tag has changed from `host` to `server` - UDP output now supported - Telegraf will now compile on FreeBSD +- Users can now specify outputs as lists, specifying multiple outputs of the +same type. ### Features - [#325](https://github.com/influxdb/telegraf/pull/325): NSQ output. Thanks @jrxFive! @@ -19,6 +21,7 @@ changed to just run docker commands in the Makefile. See `make docker-run` and - [#365](https://github.com/influxdb/telegraf/pull/365): Twemproxy plugin by @codeb2cc - [#317](https://github.com/influxdb/telegraf/issues/317): ZFS plugin, thanks @cornerot! - [#364](https://github.com/influxdb/telegraf/pull/364): Support InfluxDB UDP output. +- [#370](https://github.com/influxdb/telegraf/pull/370): Support specifying multiple outputs, as lists. - [#372](https://github.com/influxdb/telegraf/pull/372): Remove gosigar and update go-dockerclient for FreeBSD support. Thanks @MerlinDMC! ### Bugfixes diff --git a/README.md b/README.md index e25542de8..7cdaa8a2c 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ measurements at a 10s interval and will collect totalcpu & percpu data. # OUTPUTS [outputs] -[outputs.influxdb] +[[outputs.influxdb]] url = "http://192.168.59.103:8086" # required. database = "telegraf" # required. precision = "s" diff --git a/agent_test.go b/agent_test.go index 8ec4a9024..403b409f3 100644 --- a/agent_test.go +++ b/agent_test.go @@ -41,22 +41,22 @@ func TestAgent_LoadOutput(t *testing.T) { a, _ := NewAgent(config) outputsEnabled, _ := a.LoadOutputs([]string{"influxdb"}, config) - assert.Equal(t, 1, len(outputsEnabled)) + assert.Equal(t, 2, len(outputsEnabled)) outputsEnabled, _ = a.LoadOutputs([]string{}, config) - assert.Equal(t, 2, len(outputsEnabled)) + assert.Equal(t, 3, len(outputsEnabled)) outputsEnabled, _ = a.LoadOutputs([]string{"foo"}, config) assert.Equal(t, 0, len(outputsEnabled)) outputsEnabled, _ = a.LoadOutputs([]string{"influxdb", "foo"}, config) - assert.Equal(t, 1, len(outputsEnabled)) + assert.Equal(t, 2, len(outputsEnabled)) outputsEnabled, _ = a.LoadOutputs([]string{"influxdb", "kafka"}, config) - assert.Equal(t, 2, len(outputsEnabled)) + assert.Equal(t, 3, len(outputsEnabled)) outputsEnabled, _ = a.LoadOutputs([]string{"influxdb", "foo", "kafka", "bar"}, config) - assert.Equal(t, 2, len(outputsEnabled)) + assert.Equal(t, 3, len(outputsEnabled)) } func TestAgent_ZeroJitter(t *testing.T) { diff --git a/etc/config.sample.toml b/etc/config.sample.toml index 6e3ee74f6..b7aeac3cf 100644 --- a/etc/config.sample.toml +++ b/etc/config.sample.toml @@ -52,7 +52,7 @@ [outputs] # Configuration for influxdb server to send metrics to -[outputs.influxdb] +[[outputs.influxdb]] # The full HTTP endpoint URL for your InfluxDB instance # Multiple urls can be specified for InfluxDB cluster support. Server to # write to will be randomly chosen each interval. diff --git a/testdata/telegraf-agent.toml b/testdata/telegraf-agent.toml index 2af060703..7a74e12e5 100644 --- a/testdata/telegraf-agent.toml +++ b/testdata/telegraf-agent.toml @@ -49,7 +49,7 @@ [outputs] # Configuration for influxdb server to send metrics to -[outputs.influxdb] +[[outputs.influxdb]] # The full HTTP endpoint URL for your InfluxDB instance # Multiple urls can be specified for InfluxDB cluster support. Server to # write to will be randomly chosen each interval. @@ -69,8 +69,12 @@ # Set the user agent for the POSTs (can be useful for log differentiation) # user_agent = "telegraf" +[[outputs.influxdb]] + urls = ["udp://localhost:8089"] + database = "udp-telegraf" + # Configuration for the Kafka server to send metrics to -[outputs.kafka] +[[outputs.kafka]] # URLs of kafka brokers brokers = ["localhost:9092"] # Kafka topic for producer messages