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

Add network interface speed information #250

Closed
giampaolo opened this issue May 23, 2014 · 10 comments
Closed

Add network interface speed information #250

giampaolo opened this issue May 23, 2014 · 10 comments

Comments

@giampaolo
Copy link
Owner

From [email protected] on January 30, 2012 15:14:15

Proposal: add the network interface spped (100 Mbps, 1000 Mbps...) in the 
structure returned by the psutil.network_io_counters(True) function 

    # python
    # import statgrab
    # statgrab.sg_get_network_iface_stats()
    [{'duplex': 2, 'interface_name': 'lo', 'speed': 0, 'up': 1}, {'duplex': 0, 
'interface_name': 'eth0', 'speed': 100, 'up': 1}, {'duplex': 2, 
'interface_name': 'wlan0', 'speed': 0, 'up': 1}, {'duplex': 2, 
'interface_name': 'virbr0', 'speed': 0, 'up': 1}] 

Please provide any additional information below.  
-

Original issue: http://code.google.com/p/psutil/issues/detail?id=250

@giampaolo
Copy link
Owner Author

From g.rodola on January 30, 2012 06:38:27

This reminds me of issue 204 (get NICs ip/subnet/broadcast/gateway addresses) 
which we decided to reject: 
https://code.google.com/p/psutil/issues/detail?id=204#c6 I believe this is 
pretty hard to implement on all platforms.
Also, the kind of network info you can extract change depending on the 
platform; as such it's not immediately clear what API this should have.
Last: is this really useful? IMO, it isn't (can't think of a use case).

@giampaolo
Copy link
Owner Author

From [email protected] on January 30, 2012 06:47:47

I use it to display alerts in Glances ( https://github.com/nicolargo/glances ). 
For exemple, when the network bitrate of a 100 Mbps interface is higher than 70 
Mbps then the stat is displayed using a WARNING color.

In Glances v2.0, i want to replace StatGrab by PsUtil :)

@giampaolo
Copy link
Owner Author

From g.rodola on January 30, 2012 07:12:37

Interesting (and Glances looks like a nice tool).
So exactly what info are you proposing to extract from the NICs?
Just the bitrate? What do 'duplex' and 'up' parameters represent?
Being these per-NIC info only we should provide a new function (!= current 
network_io_counters()).

@giampaolo
Copy link
Owner Author

From [email protected] on January 30, 2012 07:17:08

I only use the maximum bitrate of the network interface.

I just create a wiki page for the Statgrab to PsUtil works: 
https://github.com/nicolargo/glances/wiki/Study:-replace-StatGrab-by-PSUtil Nicolas

@giampaolo
Copy link
Owner Author

From g.rodola on February 24, 2013 14:32:46

Marking it as 'accepted'.
Ideally we'd have a nics_info() function (or network_ifaces_info() in order to 
remain consistent with network_io_counters()) along these lines:

    >>> psutil.nics_info()
    {'lo':info(speed=100, up=True, duplex=2),
     'eth0':info(speed=100, up=True, duplex=2),
     ... }

Still have to look into implementation details on every platform though.

Status: Accepted

@giampaolo
Copy link
Owner Author

From g.rodola on March 03, 2013 03:18:27

I created a separate hg branch for this and started with the Linux 
implementation committed as revision 60843072901f .

Status: Started

@tevaum
Copy link

tevaum commented Sep 8, 2014

Any progress on interface speed stuff?

@giampaolo
Copy link
Owner Author

I worked on a separate branch and written different implementations (Linux, Windows, ... can't really remember) but I currently do not have time to put everything together (it's a lot of work). Realistically this is not something I will be working on any time soon, sorry.

@giampaolo
Copy link
Owner Author

Merged into master as of PR #592.

@tevaum
Copy link

tevaum commented Mar 19, 2015

Thanks! :]

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

No branches or pull requests

2 participants