5
I want a script to tell me the average CPU usage over the past 5 minutes (and repeat every 5 minutes, likely as a cron job).
/proc/stat
just has counters since system start, and I want to avoid developing a full program to parse and sample that. top
seems to just report usage over the moment (second?) before it displays/writes the table.
sysstat/sar looks promising, but looks like I'll always loose the midnight value looking at what sar -u
gives me...
1
Unfortunately, we are not a code-writing service. Instead of simply asking for code to perform a particular task, please show us what you've tried so far (including any code you currently have) and where you're stuck so that we can help you with your specific problem. Questions that only ask for code are too broad and are likely to be put on hold or closed.
– bwDraco – 2015-02-09T15:39:01.533the things I mentioned, /proc/stat, top, sar. I am not asking for the code (like I said, I don't really want custom/new code for this task), I am looking for an existing Linux utility / command line to get CPU usage info over a time period that works accross day boundaries etc (potentially along the lines of
sar -u
, but that misses the midnight value it seems...) – Fire Lancer – 2015-02-09T15:44:50.897