SqlServer - fix for default server list (#8655)

This commit is contained in:
Avinash Nigam 2021-03-02 11:55:28 -08:00 committed by GitHub
parent 9075ae5175
commit cf9ae34d03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 5 deletions

View File

@ -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 {
@ -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}}
})
}