Skip to content

Commit

Permalink
Support I (idle) process state on procfs+Linux (#3530)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzz authored and danielnelson committed Dec 11, 2017
1 parent 297282c commit 6a5d8e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/inputs/system/PROCESSES_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Using the environment variable `HOST_PROC` the plugin will retrieve process info
- zombie
- dead
- wait (freebsd only)
- idle (bsd only)
- idle (bsd and Linux 4+ only)
- paging (linux only)
- total_threads (linux only)

Expand All @@ -47,7 +47,7 @@ Linux FreeBSD Darwin meaning
Z Z Z zombie
X none none dead
T T T stopped
none I I idle (sleeping for longer than about 20 seconds)
I I I idle (sleeping for longer than about 20 seconds)
D D,L U blocked (waiting in uninterruptible sleep, or locked)
W W none paging (linux kernel < 2.6 only), wait (freebsd)
```
Expand Down
3 changes: 3 additions & 0 deletions plugins/inputs/system/processes.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func getEmptyFields() map[string]interface{} {
fields["dead"] = int64(0)
fields["paging"] = int64(0)
fields["total_threads"] = int64(0)
fields["idle"] = int64(0)
}
return fields
}
Expand Down Expand Up @@ -174,6 +175,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 6a5d8e3

Please sign in to comment.