diff --git a/plugins/outputs/opentsdb/opentsdb.go b/plugins/outputs/opentsdb/opentsdb.go index b7523c7d8..2e8cb746d 100644 --- a/plugins/outputs/opentsdb/opentsdb.go +++ b/plugins/outputs/opentsdb/opentsdb.go @@ -33,6 +33,8 @@ type OpenTSDB struct { HttpBatchSize int Debug bool + + Separator string } var sampleConfig = ` @@ -53,6 +55,9 @@ var sampleConfig = ` ## Debug true - Prints OpenTSDB communication debug = false + + ## Separator separates measurements + separator = "." ` func ToLineFormat(tags map[string]string) string { @@ -133,7 +138,8 @@ func (o *OpenTSDB) WriteHttp(metrics []telegraf.Metric, u *url.URL) error { } metric := &HttpMetric{ - Metric: sanitize(fmt.Sprintf("%s%s_%s", o.Prefix, m.Name(), fieldName)), + Metric: sanitize(fmt.Sprintf("%s%s%s%s", + o.Prefix, m.Name(), o.Separator, fieldName)), Tags: tags, Timestamp: now, Value: value, @@ -183,7 +189,7 @@ func (o *OpenTSDB) WriteTelnet(metrics []telegraf.Metric, u *url.URL) error { } messageLine := fmt.Sprintf("put %s %v %s %s\n", - sanitize(fmt.Sprintf("%s%s_%s", o.Prefix, m.Name(), fieldName)), + sanitize(fmt.Sprintf("%s%s%s%s", o.Prefix, m.Name(), o.Separator, fieldName)), now, metricValue, tags) _, err := connection.Write([]byte(messageLine))