Add memory_usage field to procstat input plugin (#6249)

This commit is contained in:
Matthew Crenshaw
2019-08-14 13:17:38 -04:00
committed by Daniel Nelson
parent 5473872ac1
commit e36639b15d
3 changed files with 10 additions and 0 deletions

View File

@@ -245,6 +245,11 @@ func (p *Procstat) addMetric(proc Process, acc telegraf.Accumulator) {
fields[prefix+"memory_locked"] = mem.Locked
}
mem_perc, err := proc.MemoryPercent()
if err == nil {
fields[prefix+"memory_usage"] = mem_perc
}
rlims, err := proc.RlimitUsage(true)
if err == nil {
for _, rlim := range rlims {