Really fix procstat initialization
This commit is contained in:
parent
6d0fbe9cf3
commit
6860545ea3
|
@ -62,6 +62,13 @@ func (_ *Procstat) Description() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Procstat) Gather(acc telegraf.Accumulator) error {
|
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)
|
procs, err := p.updateProcesses(p.procs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
|
@ -235,9 +242,6 @@ func (p *Procstat) findPids() ([]PID, map[string]string, error) {
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
inputs.Add("procstat", func() telegraf.Input {
|
inputs.Add("procstat", func() telegraf.Input {
|
||||||
return &Procstat{
|
return &Procstat{}
|
||||||
createPIDFinder: defaultPIDFinder,
|
|
||||||
createProcess: defaultProcess,
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue