Skip to content

Commit

Permalink
move port on instrumental
Browse files Browse the repository at this point in the history
  • Loading branch information
powersj committed Jul 7, 2023
1 parent daaa6a5 commit 1a5c940
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion plugins/outputs/instrumental/instrumental.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var (

type Instrumental struct {
Host string `toml:"host"`
Port string `toml:"port"`
APIToken config.Secret `toml:"api_token"`
Prefix string `toml:"prefix"`
DataFormat string `toml:"data_format"`
Expand All @@ -44,6 +45,7 @@ type Instrumental struct {

const (
DefaultHost = "collector.instrumentalapp.com"
DefaultPort = "8000"
HelloMessage = "hello version go/telegraf/1.1\n"
AuthFormat = "authenticate %s\n"
HandshakeFormat = HelloMessage + AuthFormat
Expand All @@ -70,7 +72,7 @@ func (i *Instrumental) Init() error {
}

func (i *Instrumental) Connect() error {
connection, err := net.DialTimeout("tcp", i.Host+":8000", time.Duration(i.Timeout))
connection, err := net.DialTimeout("tcp", i.Host+":"+i.Port, time.Duration(i.Timeout))

if err != nil {
i.conn = nil
Expand Down Expand Up @@ -203,6 +205,7 @@ func init() {
outputs.Add("instrumental", func() telegraf.Output {
return &Instrumental{
Host: DefaultHost,
Port: DefaultPort,
Template: graphite.DefaultTemplate,
}
})
Expand Down
3 changes: 2 additions & 1 deletion plugins/outputs/instrumental/instrumental_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func TestWrite(t *testing.T) {

i := Instrumental{
Host: "127.0.0.1",
Port: "8887",
APIToken: config.NewSecret([]byte("abc123token")),
Prefix: "my.prefix",
}
Expand Down Expand Up @@ -81,7 +82,7 @@ func TestWrite(t *testing.T) {
}

func TCPServer(t *testing.T, wg *sync.WaitGroup) {
tcpServer, err := net.Listen("tcp", "127.0.0.1:8000")
tcpServer, err := net.Listen("tcp", "127.0.0.1:8887")
require.NoError(t, err)

go func() {
Expand Down

0 comments on commit 1a5c940

Please sign in to comment.