Skip to content

Commit

Permalink
Report DEAD (X) State Process (influxdata#2501)
Browse files Browse the repository at this point in the history
Report count of processes in dead (X) process state from the processes input.  This process state is only valid on Linux.
  • Loading branch information
jeremydenoun authored and Vladislav Mugultyanov (Lazada Group) committed May 30, 2017
1 parent be70f3d commit d98bf37
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ be deprecated eventually.
- [#2387](https://github.com/influxdata/telegraf/pull/2387): Added histogram aggregator plugin.
- [#2071](https://github.com/influxdata/telegraf/issues/2071): Use official docker SDK.
- [#1678](https://github.com/influxdata/telegraf/pull/1678): Add AMQP consumer input plugin
- [#2501](https://github.com/influxdata/telegraf/pull/2501): Support DEAD(X) state in system input plugin.

### Bugfixes

Expand Down
4 changes: 3 additions & 1 deletion plugins/inputs/system/PROCESSES_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ it requires access to execute `ps`.
- stopped
- total
- zombie
- dead
- wait (freebsd only)
- idle (bsd only)
- paging (linux only)
Expand All @@ -39,6 +40,7 @@ Linux FreeBSD Darwin meaning
R R R running
S S S sleeping
Z Z Z zombie
X none none dead
T T T stopped
none I I idle (sleeping for longer than about 20 seconds)
D D,L U blocked (waiting in uninterruptible sleep, or locked)
Expand All @@ -54,5 +56,5 @@ None
```
$ telegraf -config ~/ws/telegraf.conf -input-filter processes -test
* Plugin: processes, Collection 1
> processes blocked=8i,running=1i,sleeping=265i,stopped=0i,total=274i,zombie=0i,paging=0i,total_threads=687i 1457478636980905042
> processes blocked=8i,running=1i,sleeping=265i,stopped=0i,total=274i,zombie=0i,dead=0i,paging=0i,total_threads=687i 1457478636980905042
```
5 changes: 5 additions & 0 deletions plugins/inputs/system/processes.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func getEmptyFields() map[string]interface{} {
case "openbsd":
fields["idle"] = int64(0)
case "linux":
fields["dead"] = int64(0)
fields["paging"] = int64(0)
fields["total_threads"] = int64(0)
}
Expand All @@ -107,6 +108,8 @@ func (p *Processes) gatherFromPS(fields map[string]interface{}) error {
fields["blocked"] = fields["blocked"].(int64) + int64(1)
case 'Z':
fields["zombies"] = fields["zombies"].(int64) + int64(1)
case 'X':
fields["dead"] = fields["dead"].(int64) + int64(1)
case 'T':
fields["stopped"] = fields["stopped"].(int64) + int64(1)
case 'R':
Expand Down Expand Up @@ -164,6 +167,8 @@ func (p *Processes) gatherFromProc(fields map[string]interface{}) error {
fields["blocked"] = fields["blocked"].(int64) + int64(1)
case 'Z':
fields["zombies"] = fields["zombies"].(int64) + int64(1)
case 'X':
fields["dead"] = fields["dead"].(int64) + int64(1)
case 'T', 't':
fields["stopped"] = fields["stopped"].(int64) + int64(1)
case 'W':
Expand Down

0 comments on commit d98bf37

Please sign in to comment.