Add pagefault data to procstat input plugin (#5769)
This commit is contained in:
parent
10b2a3de30
commit
9c3af1e6ac
|
@ -85,6 +85,8 @@ implemented as a WMI query. The pattern allows fuzzy matching using only
|
|||
- cgroup (when defined)
|
||||
- win_service (when defined)
|
||||
- fields:
|
||||
- child_major_faults (int)
|
||||
- child_minor_faults (int)
|
||||
- cpu_time (int)
|
||||
- cpu_time_guest (float)
|
||||
- cpu_time_guest_nice (float)
|
||||
|
@ -99,12 +101,14 @@ implemented as a WMI query. The pattern allows fuzzy matching using only
|
|||
- cpu_time_user (float)
|
||||
- cpu_usage (float)
|
||||
- involuntary_context_switches (int)
|
||||
- major_faults (int)
|
||||
- memory_data (int)
|
||||
- memory_locked (int)
|
||||
- memory_rss (int)
|
||||
- memory_stack (int)
|
||||
- memory_swap (int)
|
||||
- memory_vms (int)
|
||||
- minor_faults (int)
|
||||
- nice_priority (int)
|
||||
- num_fds (int, *telegraf* may need to be ran as **root**)
|
||||
- num_threads (int)
|
||||
|
|
|
@ -12,6 +12,7 @@ type Process interface {
|
|||
PID() PID
|
||||
Tags() map[string]string
|
||||
|
||||
PageFaults() (*process.PageFaultsStat, error)
|
||||
IOCounters() (*process.IOCountersStat, error)
|
||||
MemoryInfo() (*process.MemoryInfoStat, error)
|
||||
Name() (string, error)
|
||||
|
|
|
@ -200,6 +200,14 @@ func (p *Procstat) addMetric(proc Process, acc telegraf.Accumulator) {
|
|||
fields[prefix+"involuntary_context_switches"] = ctx.Involuntary
|
||||
}
|
||||
|
||||
faults, err := proc.PageFaults()
|
||||
if err == nil {
|
||||
fields[prefix+"minor_faults"] = faults.MinorFaults
|
||||
fields[prefix+"major_faults"] = faults.MajorFaults
|
||||
fields[prefix+"child_minor_faults"] = faults.ChildMinorFaults
|
||||
fields[prefix+"child_major_faults"] = faults.ChildMajorFaults
|
||||
}
|
||||
|
||||
io, err := proc.IOCounters()
|
||||
if err == nil {
|
||||
fields[prefix+"read_count"] = io.ReadCount
|
||||
|
|
|
@ -116,6 +116,10 @@ func (p *testProc) Tags() map[string]string {
|
|||
return p.tags
|
||||
}
|
||||
|
||||
func (p *testProc) PageFaults() (*process.PageFaultsStat, error) {
|
||||
return &process.PageFaultsStat{}, nil
|
||||
}
|
||||
|
||||
func (p *testProc) IOCounters() (*process.IOCountersStat, error) {
|
||||
return &process.IOCountersStat{}, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue