Really fix procstat initialization

This commit is contained in:
Daniel Nelson 2017-03-21 11:40:51 -07:00
parent 5c33c760c7
commit 70a0a84882
No known key found for this signature in database
GPG Key ID: CAAD59C9444F6155
1 changed files with 8 additions and 4 deletions

View File

@ -62,6 +62,13 @@ func (_ *Procstat) Description() string {
}
func (p *Procstat) Gather(acc telegraf.Accumulator) error {
if p.createPIDFinder == nil {
p.createPIDFinder = defaultPIDFinder
}
if p.createProcess == nil {
p.createProcess = defaultProcess
}
procs, err := p.updateProcesses(p.procs)
if err != nil {
return fmt.Errorf(
@ -235,9 +242,6 @@ func (p *Procstat) findPids() ([]PID, map[string]string, error) {
func init() {
inputs.Add("procstat", func() telegraf.Input {
return &Procstat{
createPIDFinder: defaultPIDFinder,
createProcess: defaultProcess,
}
return &Procstat{}
})
}