Skip to content

Commit

Permalink
SqlServer - fix for default server list (influxdata#8655)
Browse files Browse the repository at this point in the history
  • Loading branch information
avinash-nigam authored Mar 2, 2021
1 parent 9075ae5 commit cf9ae34
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions plugins/inputs/sqlserver/sqlserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,6 @@ func (s *SQLServer) Gather(acc telegraf.Accumulator) error {
}
}

if len(s.Servers) == 0 {
s.Servers = append(s.Servers, defaultServer)
}

var wg sync.WaitGroup

for _, serv := range s.Servers {
Expand Down Expand Up @@ -327,8 +323,16 @@ func (s *SQLServer) accRow(query Query, acc telegraf.Accumulator, row scanner) e
return nil
}

func (s *SQLServer) Init() error {
if len(s.Servers) == 0 {
log.Println("W! Warning: Server list is empty.")
}

return nil
}

func init() {
inputs.Add("sqlserver", func() telegraf.Input {
return &SQLServer{}
return &SQLServer{Servers: []string{defaultServer}}
})
}

0 comments on commit cf9ae34

Please sign in to comment.