-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Add running field to procstat_lookup #5069
Conversation
@LTKH Can you give this changeset a shot and let me know if it works out okay? |
@danielnelson Tested. If the pid file is missing, |
Yeah I can do that, good catch. |
I made a few changes, it is always showing the running count now but I also added a result tag+result_code field for the status of the lookup. If the lookup fails the metric will still be emitted as well. |
@danielnelson Tested. Works perfect! Thank you. |
@@ -93,6 +93,7 @@ func (p *Procstat) Gather(acc telegraf.Accumulator) error { | |||
case "pgrep": | |||
p.createPIDFinder = NewPgrep | |||
default: | |||
p.PidFinder = "pgrep" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this fit better in the init function, as it seems to be a standard location for object defaults?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this out, it seems good but then it moves it away from the setting of p.createPIDFinder
, which it would need updated alongside of. We could set that in the init function too, but then we would need to introduce a initialized boolean or such. We can rework this when we add constructor functions for the plugins (part of the config prototype).
This field indicates the number of processes that were actually found, as opposed to pid_count which tells you how many pids were found and may not be what you are after with some query methods.
closes #5043
Required for all PRs: