-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
fallback mechanism for /proc/1/mountinfo to /proc/self/mountinfo can produce noisy logs #1271
Comments
I would suggest a |
Could you tell us that log message and who emits? If it is not avoidable, I agree to @Lomanic regarding variable name, |
In my case, I'm using this with telegraf running as a snap (experimental), and two log entries occur every 10 seconds (due to the default telegraf configuration for disks), but this could happen with other AppArmor policy:
|
@shirou - I could do this easily, sure. I did think about before submitting it and chose not to because all of those seem designed for "Hey, I know I'm running in a different environment so I'd like to use this other location instead". This issue is different because:
Again, I'm happy to adjust if you feel HOST_PROC_MOUNTINFO is still the right approach. |
@shirou - ping |
Sorry to late response. I think to align with other environment variables, |
A binary toggle really ties our hands and leaks the lib internals (what if we had to invert the logic, again), |
Will want to use this when the new telegraf pulls in the new gopsutil. shirou/gopsutil#1271 shirou/gopsutil#1272
Describe the bug
The changes to
gopsutil
for reading/proc/1/mountinfo
affected applications running under restricted environments that disallow access to/proc/1/mountinfo
and the recent fix for #1159 (filed for android but other restricted environments are also affected (eg, snaps)) fixes application behavior to work under confinement (thanks!). However, depending on the system, the attempt to read/proc/1/mountinfo
could cause a sandbox denial in the logs which can be quite noisy if usinggopsutil
as part of a monitoring solution that polls often.I suggest introducing an environment variable to force the old behavior. Eg, use the current behavior on
master
but introduce a newSELF_MOUNTINFO
environment variable to use/proc/self/mountinfo
without first trying/proc/1/mountinfo
. This allows people to setSELF_MOUNTINFO=1
whengopsutil
is running under these restricted environments.I plan to submit a PR for this.
Expected behavior
gopsutil
continues with current fallback behavior by default but allows reading only/proc/self/mountinfo
so thatgopsutil
can function correctly without introducing noisy log entries.Environment (please complete the following information):
ver
]/etc/os-release
and the result ofuname -a
]sw_vers
anduname -a
freebsd-version -k -r -u
anduname -a
]uname -a
]Additional context
[Cross-compiling? Paste the command you are using to cross-compile and the result of the corresponding
go env
]The text was updated successfully, but these errors were encountered: