What is the easiest way to get network statistics (bandwidth used, current down/up rate) via Python.
I realize it’ll have to be a system call to /proc, but is there an easier way or some tool that is available on standard *nix distributions for doing so?
Thanks
NOTE: I am going to use /proc/net/dev and parse the output 😎
You could try using http://pypi.python.org/pypi/pynetinfo/ – it would need extending to get the statistics, but that should be fairly trivial. Most of the code is already in place.
Alternatively you can just parse the output of
ip -s link show device_name