parent
c9e0ae4d81
commit
a852e8106e
|
@ -81,6 +81,7 @@ plugins, not just statsd.
|
|||
- [#1975](https://github.com/influxdata/telegraf/issues/1975) & [#2102](https://github.com/influxdata/telegraf/issues/2102): Fix thread-safety when using multiple instances of the statsd input plugin.
|
||||
- [#2027](https://github.com/influxdata/telegraf/issues/2027): docker input: interface conversion panic fix.
|
||||
- [#1814](https://github.com/influxdata/telegraf/issues/1814): snmp: ensure proper context is present on error messages
|
||||
- [#2299](https://github.com/influxdata/telegraf/issues/2299): opentsdb: add tcp:// prefix if no scheme provided.
|
||||
|
||||
## v1.1.2 [2016-12-12]
|
||||
|
||||
|
|
|
@ -59,6 +59,9 @@ func ToLineFormat(tags map[string]string) string {
|
|||
}
|
||||
|
||||
func (o *OpenTSDB) Connect() error {
|
||||
if !strings.HasPrefix(o.Host, "http") && !strings.HasPrefix(o.Host, "tcp") {
|
||||
o.Host = "tcp://" + o.Host
|
||||
}
|
||||
// Test Connection to OpenTSDB Server
|
||||
u, err := url.Parse(o.Host)
|
||||
if err != nil {
|
||||
|
@ -68,11 +71,11 @@ func (o *OpenTSDB) Connect() error {
|
|||
uri := fmt.Sprintf("%s:%d", u.Host, o.Port)
|
||||
tcpAddr, err := net.ResolveTCPAddr("tcp", uri)
|
||||
if err != nil {
|
||||
return fmt.Errorf("OpenTSDB: TCP address cannot be resolved")
|
||||
return fmt.Errorf("OpenTSDB TCP address cannot be resolved: %s", err)
|
||||
}
|
||||
connection, err := net.DialTCP("tcp", nil, tcpAddr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("OpenTSDB: Telnet connect fail")
|
||||
return fmt.Errorf("OpenTSDB Telnet connect fail: %s", err)
|
||||
}
|
||||
defer connection.Close()
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue