Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEAD (X) State Process #2501

Merged
merged 8 commits into from
Mar 9, 2017
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ be deprecated eventually.
- [#2339](https:/influxdata/telegraf/pull/2339): Increment gather_errors for all errors emitted by inputs.
- [#2071](https:/influxdata/telegraf/issues/2071): Use official docker SDK.
- [#1678](https:/influxdata/telegraf/pull/1678): Add AMQP consumer input plugin
- [#2501](https:/influxdata/telegraf/pull/2501): Support DEAD(X) state in system input plugin.

### Bugfixes

Expand Down
2 changes: 2 additions & 0 deletions 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 X X dead
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? I think it should be X none none based on manpages I've found online.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I read https://www.freebsd.org/cgi/man.cgi?ps(1)

X The process is being traced or debugged.

similar on http://www.manpages.info/macosx/ps.1.html

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This switch is only over the first character though, and as I read it X cannot be the first char on these other platforms.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have right

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 Down
5 changes: 5 additions & 0 deletions plugins/inputs/system/processes.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func getEmptyFields() map[string]interface{} {
fields := map[string]interface{}{
"blocked": int64(0),
"zombies": int64(0),
"dead": int64(0),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets put this below in the linux case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

"stopped": int64(0),
"running": int64(0),
"sleeping": int64(0),
Expand Down Expand Up @@ -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