You are not logged in.

#1 2021-06-13 09:23:06

DireWolf
Member
Registered: 2021-04-15
Posts: 28

Monitoring and Logging Net usage by individual PID

Hello all,

How can I do the following:- Requirements:-
1) Log individual data, that I can query anytime to find out today's total net usage by pid.
2) Log times by hours, so that I can find at which hour how much data was used.
<not neccesary but an icing on the cake> 3)support for logging the data into a SQL-like database....

Current solutions and why they don't work:-
1. VNstat is near perfect but it shows cumulative data i.e not by individual pid/process name.
2. Other individual PID net trackers like iptraf,nethogs,iptop offer current bandwidth usage and socket mapping but little to no support for logging data.
3. /proc/[pid]/net/ contains dev but thats the total usage and not for individual pid.... (i cant parse out or understand the information in the rest of the files)

I am comfortable with bash scripting and C/C++ programming so some value in /proc/[pid]/net/<usage> can be harnessed but reletevily less documentation is available online for the format of the data present there.
I would also possibly integrate  all above in an open-source solution/set of script for the benefit of all.

Any help, suggestions would be apprietated.

Yours Linuxing,
DireWolf

Offline

Board footer

Powered by FluxBB