Skip to content

Commit 13f314a

Browse files
jeremydenoundanielnelson
authored andcommitted
Report DEAD (X) State Process (#2501)
Report count of processes in dead (X) process state from the processes input. This process state is only valid on Linux.
1 parent ea6e0b8 commit 13f314a

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ be deprecated eventually.
5656
- [#2339](https://github.com/influxdata/telegraf/pull/2339): Increment gather_errors for all errors emitted by inputs.
5757
- [#2071](https://github.com/influxdata/telegraf/issues/2071): Use official docker SDK.
5858
- [#1678](https://github.com/influxdata/telegraf/pull/1678): Add AMQP consumer input plugin
59+
- [#2501](https://github.com/influxdata/telegraf/pull/2501): Support DEAD(X) state in system input plugin.
5960

6061
### Bugfixes
6162

plugins/inputs/system/PROCESSES_README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ it requires access to execute `ps`.
2323
- stopped
2424
- total
2525
- zombie
26+
- dead
2627
- wait (freebsd only)
2728
- idle (bsd only)
2829
- paging (linux only)
@@ -39,6 +40,7 @@ Linux FreeBSD Darwin meaning
3940
R R R running
4041
S S S sleeping
4142
Z Z Z zombie
43+
X none none dead
4244
T T T stopped
4345
none I I idle (sleeping for longer than about 20 seconds)
4446
D D,L U blocked (waiting in uninterruptible sleep, or locked)
@@ -54,5 +56,5 @@ None
5456
```
5557
$ telegraf -config ~/ws/telegraf.conf -input-filter processes -test
5658
* Plugin: processes, Collection 1
57-
> processes blocked=8i,running=1i,sleeping=265i,stopped=0i,total=274i,zombie=0i,paging=0i,total_threads=687i 1457478636980905042
59+
> processes blocked=8i,running=1i,sleeping=265i,stopped=0i,total=274i,zombie=0i,dead=0i,paging=0i,total_threads=687i 1457478636980905042
5860
```

plugins/inputs/system/processes.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ func getEmptyFields() map[string]interface{} {
8181
case "openbsd":
8282
fields["idle"] = int64(0)
8383
case "linux":
84+
fields["dead"] = int64(0)
8485
fields["paging"] = int64(0)
8586
fields["total_threads"] = int64(0)
8687
}
@@ -107,6 +108,8 @@ func (p *Processes) gatherFromPS(fields map[string]interface{}) error {
107108
fields["blocked"] = fields["blocked"].(int64) + int64(1)
108109
case 'Z':
109110
fields["zombies"] = fields["zombies"].(int64) + int64(1)
111+
case 'X':
112+
fields["dead"] = fields["dead"].(int64) + int64(1)
110113
case 'T':
111114
fields["stopped"] = fields["stopped"].(int64) + int64(1)
112115
case 'R':
@@ -164,6 +167,8 @@ func (p *Processes) gatherFromProc(fields map[string]interface{}) error {
164167
fields["blocked"] = fields["blocked"].(int64) + int64(1)
165168
case 'Z':
166169
fields["zombies"] = fields["zombies"].(int64) + int64(1)
170+
case 'X':
171+
fields["dead"] = fields["dead"].(int64) + int64(1)
167172
case 'T', 't':
168173
fields["stopped"] = fields["stopped"].(int64) + int64(1)
169174
case 'W':

0 commit comments

Comments
 (0)