Ubuntu: Monitor CPU and bandwidth usage of cpu and save to csv


I would like to monitor a specific process. I need to know timestamp, CPU usage (%) and Bandwidth (tcp upload and download in % or byte/s) of this process.

I have tried something like this:

ps -Ao time,pcpu,comm --sort=pid | head -n 2

But time is not equal date. For network if stat looks goed but it doesnot monitor process.

Further I would like to put it a CSV file like this:

Date; CPU%; Upload%; Download%;  

How can I manage this?

Thank you.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »