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

Accurate reporting for host machine - when inside a docker container #49

Open
gotjoshua opened this issue Feb 3, 2019 · 5 comments
Open

Comments

@gotjoshua
Copy link

I was trying to use ps_mem inside a glances container to write logs in response to alerts.
The glances docker container that I ran ps_mem inside of has full access to the host and shows processes correctly. Unfortunately, ps_mem did not list the actual processes from the host.

Is there a trick to make this work as is? or would it be a feature request?

@pixelb
Copy link
Owner

pixelb commented Feb 4, 2019

If there was a way to get the pids associated with the container, one could pass them to ps_mem -p pid1,pid2. If glances operates in a separate pid namespace, one might be able to remount /proc within that container to get the PID subset?

@gotjoshua
Copy link
Author

gotjoshua commented Feb 6, 2019

Hi, thanks for the reply!

I did try that strategy (getting the pids from ps and then passing them to ps_mem via ps_mem -p pid1,pid2 but the output was empty... most likely, due the missing /proc

is that safe to just mount the host's proc folder into a container?

You can't mount to /proc.

Or can you suggest precisely where to mount it to?

@pixelb
Copy link
Owner

pixelb commented Feb 6, 2019

You should be able to mount /proc and need it available

@gotjoshua
Copy link
Author

gotjoshua commented Feb 7, 2019

i tried

volumes:
 - /proc/:/proc/

and got an error

do you have another suggestion where to mount it and how to tell ps_mem where to look for it?

@NHellFire
Copy link

You'll need to run the glances container with --pid host for it to not have a separate PID namespace (as mentioned in their docs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants