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

@@ -4,6 +4,9 @@ import (
"net"
"net/url"
"os"
"time"
"github.com/influxdb/influxdb/client"
)
var localhost = "localhost"
@@ -27,3 +30,17 @@ func GetLocalHost() string {
}
return localhost
}
// MockBatchPoints returns a mock BatchPoints object for using in unit tests
// of telegraf output sinks.
func MockBatchPoints() client.BatchPoints {
var bp client.BatchPoints
bp.Time = time.Now()
bp.Tags = map[string]string{"tag1": "value1"}
bp.Points = []client.Point{
{
Fields: map[string]interface{}{"value": 1.0},
},
}
return bp
}