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

input.procstat : be able to search process by user and name #14666

Closed
tguenneguez opened this issue Feb 1, 2024 · 4 comments
Closed

input.procstat : be able to search process by user and name #14666

tguenneguez opened this issue Feb 1, 2024 · 4 comments
Labels
feature request Requests for new plugin and for new features to existing plugins

Comments

@tguenneguez
Copy link
Contributor

Use Case

It is currently not possible to collect information about a process by filtering on name and user.
For example, on some applications, there is a parent process owned by root that is critical and child processes that do not deserve supervision.
It would therefore seem wise to me that the collection criteria be cumulative.

[[inputs.procstat]]
exe = "httpd"
user = "root"

This is documented in :
https://github.com/influxdata/telegraf/blob/master/plugins/inputs/procstat/README.md#procstat-input-plugin

Expected behavior

Telefraf report data only for httpd processes running as root.

Actual behavior

Telefraf report data for all httpd processes.

Additional info

What do you think ?
Perhaps this requires a breaking change?

I would like to try to make a PR on the subject.

Another question :
Why maintain 2 collection systems on the servers?
The default mode (pgrep) requires a binary which is not necessarily present on all platforms (eg: Windows).
Why isn't "native" mode the default? What is its disadvantage?

@tguenneguez tguenneguez added the feature request Requests for new plugin and for new features to existing plugins label Feb 1, 2024
@powersj
Copy link
Contributor

powersj commented Feb 1, 2024

Hi,

I would instead suggest using metricpass via a combination of the following or something similar:

[[inputs.procstat]]
  user = "root"
  metricpass = "tags.process_name == \"httpd\""

There are a number of different methods on proctstat to gather information. This is due to historical reasons of adding more and more reasons. We certainly are not breaking this and instead you can use filtering.

Don't assume the defaults were chosen because they are the best, it could be that they were the first implemented as this plugin has had a lot of development over time.

@powersj powersj closed this as not planned Won't fix, can't repro, duplicate, stale Feb 1, 2024
@tguenneguez
Copy link
Contributor Author

It look like :
#6174

@tguenneguez
Copy link
Contributor Author

tguenneguez commented Feb 15, 2024

Sorry @powersj
I don't find doc about metricpass on https://docs.influxdata.com/telegraf/v1/configuration/#filters
I find some lite info on https://github.com/influxdata/telegraf/blob/master/docs/CONFIGURATION.md
Why ?

What is the difference between :

[[inputs.procstat]]
  user = "root"
  metricpass = "tags.process_name == \"httpd\""

and

[[inputs.procstat]]
  user = "root"
  [[inputs.procstat.tagdrop]
    process_name = ["httpd"]

Thanks
Thomas

@powersj
Copy link
Contributor

powersj commented Feb 15, 2024

@tguenneguez,

If you have general questions can you please use the slack or forums, rather than asking on closed issue?

I don't find doc about metricpass on https://docs.influxdata.com/telegraf/v1/configuration/#filters
I find some lite info on https://github.com/influxdata/telegraf/blob/master/docs/CONFIGURATION.md
Why ?

Those docs are not kept 100% in line with the repo. Feel free to scroll to the bottom of the docs site and file an issue there.

What is the difference between :

Run it and see ;)
The first, using metricpass, will pass metrics that have that tag and value. The second, use tagdrop, will drop metrics with that tag and value, where as tagpass will do the same as metricpass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requests for new plugin and for new features to existing plugins
Projects
None yet
Development

No branches or pull requests

2 participants