I'm looking for a way to programatically (whether calling a library, or a standalone program) monitor live ip traffic in linux. I don't want totals, i want the current bandwidth that is being used. I'm looking for a tool similar (but non-graphical) to OS X's istat menu's network traffic monitor.
I'm fairly certain something like this exists, but I'm not sure where to look, and i'd rather not have to reinvent the wheel.
Is it as simple as monitoring a socket? Or do I need a utility that handles alot of overhead for me?