Skip to content

Commit

Permalink
lanz+logstash
Browse files Browse the repository at this point in the history
  • Loading branch information
zak-pawel committed Nov 11, 2024
1 parent fd038ef commit 5a9265c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
6 changes: 1 addition & 5 deletions plugins/inputs/lanz/lanz.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,8 @@ func msgToAccumulator(acc telegraf.Accumulator, msg *pb.LanzRecord, deviceURL *u
}
}

func newLanz() *Lanz {
return &Lanz{}
}

func init() {
inputs.Add("lanz", func() telegraf.Input {
return newLanz()
return &Lanz{}
})
}
10 changes: 4 additions & 6 deletions plugins/inputs/lanz/lanz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,11 @@ var testProtoBufGlobalBufferUsageRecord = &pb.LanzRecord{
}

func TestLanzGeneratesMetrics(t *testing.T) {
var acc testutil.Accumulator

l := newLanz()

l.Servers = append(l.Servers,
l := &Lanz{Servers: []string{
"tcp://switch01.int.example.com:50001",
"tcp://switch02.int.example.com:50001",
)
}}

deviceURL1, err := url.Parse(l.Servers[0])
if err != nil {
t.Fail()
Expand All @@ -69,6 +66,7 @@ func TestLanzGeneratesMetrics(t *testing.T) {
t.Fail()
}

var acc testutil.Accumulator
msgToAccumulator(&acc, testProtoBufCongestionRecord1, deviceURL1)
acc.Wait(1)

Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/logstash/logstash.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (logstash *Logstash) Init() error {
return nil
}

func (logstash *Logstash) Start(_ telegraf.Accumulator) error {
func (*Logstash) Start(telegraf.Accumulator) error {
return nil
}

Expand Down

0 comments on commit 5a9265c

Please sign in to comment.