-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Allow specifying /proc and other needed folders #558
Comments
Mmm... it's not clear to me why anyone would want to change the default /proc location as I suppose a lot of different system tools makes the assumption that /proc lives in "/proc", not only psutil. Is this something you do explicitly or is it Docker which does it? |
Yes I agree in 99.99% of the time /proc is /proc. So CoreOS which is a OS made for docker it does not have a package manager so there is no way to install new software on the server it assumes that everything you need to do can run from another docker container. And if that docker continer needs access to /proc for getting monitoring data then you mount that /proc from the host OS to some other location on the container. |
Yes. I would say that another possible approach here in case /proc is /proc_host or whatever is to just create a symlink to /proc. This has the downside that it requires root privileges though. Is that something you can do by default with CoreOS? What is the default /proc location in CoreOS? I'm wondering whether that can be determined at runtime. |
Not sure if you used docker before or openvz. but each container is acting like its own operating system but shares the same kernel as the host but uses cgroups to limit the scope of processes that the container can see. I can mount the /proc easily to /proc_host but its hard to get the system to work correctly if i mount /proc of the host over the /proc of the container. |
+1 with the following use case : mount the host rootfs in a docker container and get some metrics from psutil, like cAdvisor "--volume=/:/rootfs:ro". |
OK, I'm convinced there's an use case which justifies this change. Line 62 in 999dc85
The first thing which pops into my mind is to define a
I'm not too happy about this though because we are accessing a private module. I can't think of any other solution though (also renaming the module doesn't fully convince me). |
I hate to say it, but what about a module property in Or don't even make it a property, make it a constant, and make GIampaolo, you always have fun programming problems :) P.S. At least one of those suggestions is a joke, can you guess which one(s)? Trick or Treat ;) |
Thanks for chiming in Josiah. =)
I knew you'd say that. =)
Not possible. This would create a circular import because it's
This is more interesting. I have tried to Another possitility would be to provide a |
Funnily enough, the module property actually answers the problem pretty well, and wasn't the joke. If When I pull down the git repo, do a quick make, add the attribute to
I get the following behavior:
So that one should work, if you are using the right
Importing |
This was the issue indeed. Cool! I will stick with |
Always happy to help. Save the beer money for your travel, and we'll run into each other again somewhere between LA and Turin :D |
Works well, thanks a lot : ) |
;-) |
The very excellent work that went in under giampaolo#558 gave us a psutil that can be used on systems with a moved /proc. However, on some systems (e.g. test harnesses, containers) may not have any files mounted at /proc at all. In these cases, psutil fails at import time with an IOError trying to access /proc/stat. This patch removes the import-time dependency on a live procfs mounted at /proc, and validates the behavior of some of the details we were hoping to read at import time (i.e. cpu % stats).
The very excellent work that went in under giampaolo#558 gave us a psutil that can be used on systems with a moved /proc. However, on some systems (e.g. test harnesses, containers) may not have any files mounted at /proc at all. In these cases, psutil fails at import time with an IOError trying to access /proc/stat. This patch removes the import-time dependency on a live procfs mounted at /proc, and validates the behavior of some of the details we were hoping to read at import time (i.e. cpu % stats).
The very excellent work that went in under giampaolo#558 gave us a psutil that can be used on systems with a moved /proc. However, on some systems (e.g. test harnesses, containers) may not have any files mounted at /proc at all. In these cases, psutil fails at import time with an IOError trying to access /proc/stat. This patch removes the import-time dependency on a live procfs mounted at /proc, and validates the behavior of some of the details we were hoping to read at import time (i.e. cpu % stats).
The very excellent work that went in under giampaolo#558 gave us a psutil that can be used on systems with a moved /proc. However, on some systems (e.g. test harnesses, containers) may not have any files mounted at /proc at all. In these cases, psutil fails at import time with an IOError trying to access /proc/stat. This patch removes the import-time dependency on a live procfs mounted at /proc, and validates the behavior of some of the details we were hoping to read at import time (i.e. cpu % stats).
The very excellent work that went in under giampaolo#558 gave us a psutil that can be used on systems with a moved /proc. However, on some systems (e.g. test harnesses, containers) may not have any files mounted at /proc at all. In these cases, psutil fails at import time with an IOError trying to access /proc/stat. This patch removes the import-time dependency on a live procfs mounted at /proc, and validates the behavior of some of the details we were hoping to read at import time (i.e. cpu % stats).
The use case of this is running monitoring tools or scripts built around psutil that run inside docker continents. With docker the admin can specify that the /proc of the host machine is read only and mounted in a location on the sub continent the issue for this is that /proc room the host maybe /proc_host and then you need to read things from there for monitoring. An issue that comes up is CoreOS and a few other docker OS dont have package managers so there is no way to really install tools there its expected that the user installs the tools in a docker container.
The text was updated successfully, but these errors were encountered: