Skip to content

Commit

Permalink
fix(inputs.mongodb): actually start plugin correctly
Browse files Browse the repository at this point in the history
The start method handler did not match the interface, nor was there a
stop function. As a result, start was never called and the plugin was
never setting up the servers to connect to and collect from correctly.

This was introduced in influxdata#11629.

fixes: influxdata#11830
  • Loading branch information
powersj committed Sep 20, 2022
1 parent 8dd7ec0 commit 8bb8e33
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/inputs/mongodb/mongodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (m *MongoDB) Init() error {
}

// Start runs after init and setup mongodb connections
func (m *MongoDB) Start() error {
func (m *MongoDB) Start(telegraf.Accumulator) error {
for _, connURL := range m.Servers {
if !strings.HasPrefix(connURL, "mongodb://") && !strings.HasPrefix(connURL, "mongodb+srv://") {
// Preserve backwards compatibility for hostnames without a
Expand Down Expand Up @@ -144,6 +144,8 @@ func (m *MongoDB) Start() error {
return nil
}

func (m *MongoDB) Stop() {}

// Reads stats from all configured servers accumulates stats.
// Returns one of the errors encountered while gather stats (if any).
func (m *MongoDB) Gather(acc telegraf.Accumulator) error {
Expand Down

0 comments on commit 8bb8e33

Please sign in to comment.