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
[linux] make /proc configurable. #2482
Conversation
output, _, _ = get_subprocess_output(['grep', 'model name', '/proc/cpuinfo'], log) | ||
if not proc_path: | ||
proc_path = "/proc" | ||
proc_cpuinfo = "{}/cpuinfo".format(proc_path.rstrip('/')) |
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.
Using os.path.join
is usually more reliable for this kind of thing. You would also not have to worry about calling rstrip
in a lot of places.
A few nits, and hopefully we can move some of the duplicated logic in the mother class. I'm also wondering about these 2:
And the tests are failing on snmpd, I triggered it again in case it's flaky but if it doesn't pass you should have a look. |
@@ -15,6 +15,7 @@ | |||
from checks import AgentCheck | |||
from checks.metric_types import MetricTypes | |||
from config import _is_affirmative | |||
from utils.platform import Platform |
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.
You need to remove this import, flake8 is failing on it as it's not used.
fa77905
to
b8c25d5
Compare
LGTM |
[procfs] consistent naming with other checks that allow procfs path configuration. [procfs] if set in agentconfig, override everywhere where psutil comes to play too. [procfs] adding procfs_pathoption to example datadog.conf. [procfs] use procfs_path where relevant. [procfs] defer importing get_config to avoid circular dependency ImportError.
6c5819f
to
5f481fc
Compare
Allows overriding of
/proc
by definingprocfs_path
indatadog.conf
- should be enforcable by usingself.agentConfig.get("procfs_path")
from any of the checks. I believe we enforce that pretty much everywhere relevant with this PR.Places where we haven't overriden it just yet: