Kafka output producer, send telegraf metrics to Kafka brokers

Closes #38
This commit is contained in:
Cameron Sparr
2015-08-26 11:02:10 -06:00
parent 434267898b
commit d1f965ae30
10 changed files with 167 additions and 33 deletions

View File

@@ -0,0 +1,28 @@
package kafka
import (
"testing"
"github.com/influxdb/telegraf/testutil"
"github.com/stretchr/testify/require"
)
func TestConnectAndWrite(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
brokers := []string{testutil.GetLocalHost() + ":9092"}
k := &Kafka{
Brokers: brokers,
Topic: "Test",
}
// Verify that we can connect to the Kafka broker
err := k.Connect()
require.NoError(t, err)
// Verify that we can successfully write data to the kafka broker
err = k.Write(testutil.MockBatchPoints())
require.NoError(t, err)
}