How do we extract CPU usage in server?

We are using linux OS. I want to extract the CPU usage on specific time for last one week. The information i need is,

date, CPU, %user , %nice , %system , %iowait, %idle

Is there anyway, i can pull these info... Any help is highly appreciated.

Hi,

look at the sar (system activity reporter) package.

Cheers,
Lo�c.

It helps... But how can i bring history informaton. I mean, i need to find, what is the CPU usage on specic date or last one week

Normally, you set-up a cron that collects data with sa1, and performs daily a report with sa2. Something along the lines:

root# cat /etc/cron.d/sysstat 
# run system activity accounting tool every 10 minutes
*/10 * * * * root /usr/lib64/sa/sa1 1 1
# generate a daily summary of process accounting at 23:53
53 23 * * * root /usr/lib64/sa/sa2 -A

The activity reports are then located at /var/log/sadd (assuming the default location) where dd ist the current day of the month. Then you can read a particular report using sar -f.

Eventually, a similar cron job might already be active on your system. In this case, check your manpage for the default report location, and use sar to read the activity at a given day.

Cheers,
Lo�c.

Thank you... I thought, we have some commands to pull this kind of reports..