Search code examples
linuxloadcpulogfiles

Linux display average CPU load for last week


On a Linux box, I need to display the average CPU utilisation per hour for the last week. Is that information logged somewhere? Or do I need to write a script that wakes up every 15 minutes to copy /proc/loadavg to a logfile?

EDIT: I'm not allowed to use any tools other than those that come with Linux.


Solution

  • As far as I know it's not stored anywhere... It's a trivial thing to write, anyway. Just add something like

    cat /proc/loadavg >> /var/log/loads
    

    to your crontab.

    Note that there are monitoring tools (like Munin) which can do this kind of thing for you, and generate pretty graphs of it to boot... they might be overkill for your situation though.