Python Network Event Statistics Linux

Python Network Event Statistics Linux … here is a solution to the problem.

Python Network Event Statistics Linux

What is the easiest way to get network statistics (bandwidth used, current falling/rising rate) through Python.

I realize it has to be a system call to /proc, but is there an easier way or some of the tools available on the standard *nix release to do so?

Thanks

Note: I’ll use /proc/net/dev and parse output 😎

Solution

You can try using http://pypi.python.org/pypi/pynetinfo/ – it needs to be extended to get statistics, But this should be trivial. Most of the code is already in place.

Alternatively, you can just parse the output of ip -s link show device_name

Related Problems and Solutions