New issue 250 by nicolash...@gmail.com: Add network interface speed
information
http://code.google.com/p/psutil/issues/detail?id=250
Proposal
Add the network interface spped (100 Mbps, 1000 Mbps...) in the structure
returned by the psutil.network_io_counters(True) function
On what platforms would this be available?
Any
Proposed API
-
Are there existent implementations we can use as an example?
# 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.
-
This reminds me of issue 204 (get NICs ip/subnet/broadcast/gateway
addresses) which we decided to reject:
http://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).
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 :)
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()).
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