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

Is it possible to list net_io_counters for all running processes? #729

Closed
tonygaetani opened this issue Jan 15, 2016 · 1 comment
Closed

Comments

@tonygaetani
Copy link

I want to get the network statistics for all running processes that are owned by a specific user. psutil.net_io_counters(pernic=True) seems like a really great option for me, but I'd like to get this information for everything in /proc. The psutil.process_iter() seems like a nice way to navigate /proc but it's missing net_io_counters as an attribute. Am I missing something, or would I need to add this functionality to the library?

I'm looking for something like this:

import psutil

for proc in psutil.process_iter():
    try:
        pinfo = proc.as_dict(attrs=['username', 'net_io_counters'])
    except psutil.NoSuchProcess:
        pass
    else:
        print(pinfo)
@tonygaetani
Copy link
Author

Okay I've made some bad assumptions here. /proc just does not contain the information I'm looking for, there's a good explanation of why here: http://unix.stackexchange.com/questions/224201/what-is-proc-pid-net-dev

I'm going to assume what I'm looking for (network statistics of a single process, rather than system wide network usage) is probably outside of the scope of psutil. Closing...

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

1 participant