I am trying to find at time T the average CPU usage on 1, 5, and 15min, just like what you get from /proc/loadavg

Same thing for virtual memory, and swap memory.

I would be fine with a python library too, I've looked into psutils and procfs without success.

2 Answers 2


I think that vmstat does what you need.

From the man page:

vmstat reports information about processes, memory, paging, block IO, traps, disks and cpu activity.

The first report produced gives averages since the last reboot.
Additional reports give information on a sampling period of length delay.


if you have sysstat installed you can use sar command


sar -q
               runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
16:49:01            0       173      0.00      0.01      0.05         1
16:50:01            0       173      0.00      0.01      0.05         0

from sar 's man page

-q Report queue length and load averages. The following values are displayed:

  • IIRC, sar needs daily files to function properly. I need a way to find at any time the average CPU and RAM usage with what is already on the system. I think I will just look in /proc and do the parsing myself
    – user89578
    Oct 30, 2014 at 13:17
  • sysstat collects all system stats using a cron and if that has not been run you cannot get any statistics using it. It does not use /proc for historical data.
    – Abey
    Oct 30, 2014 at 14:07

You must log in to answer this question.