Skip to content

Commit

Permalink
Support I (idle) process state on procfs+Linux
Browse files Browse the repository at this point in the history
`I` is a Linux process state: https://github.com/torvalds/linux/blob/master/fs/proc/array.c#L135

This is a fairly recent change but causes lots of Telegraf log noise with 4.x kernels.
  • Loading branch information
tzz authored Nov 30, 2017
1 parent a995171 commit cbb3137
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugins/inputs/system/processes.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,15 @@ func getEmptyFields() map[string]interface{} {
"stopped": int64(0),
"running": int64(0),
"sleeping": int64(0),
"idle": int64(0),
"total": int64(0),
"unknown": int64(0),
}
switch runtime.GOOS {
case "freebsd":
fields["idle"] = int64(0)
fields["wait"] = int64(0)
case "darwin":
fields["idle"] = int64(0)
case "openbsd":
fields["idle"] = int64(0)
case "linux":
fields["dead"] = int64(0)
fields["paging"] = int64(0)
Expand Down Expand Up @@ -174,6 +172,8 @@ func (p *Processes) gatherFromProc(fields map[string]interface{}) error {
fields["stopped"] = fields["stopped"].(int64) + int64(1)
case 'W':
fields["paging"] = fields["paging"].(int64) + int64(1)
case 'I':
fields["idle"] = fields["idle"].(int64) + int64(1)
default:
log.Printf("I! processes: Unknown state [ %s ] in file %s",
string(stats[0][0]), filename)
Expand Down

0 comments on commit cbb3137

Please sign in to comment.