CPU, memory and disk stats

I've been asked to gather CPU, memory and disk stats in the following format:

Cpu_Max Cpu_Min Cpu_Avg Mem_Max Mem_Min Mem_Avg Disk_Max Disk_Min Disk_Avg

Can anyone please tell me a command to gather all this info?

Thanks!
Todd

  • HD: format, prtvtoc
    • cpu, mem: prtdiag, psrinfo -v, iostat -En (HD-Status)

What do you mean with Max, Min and Avg? These are values that implies a continuous monitoring of system resources in a certain range of time.

Once collected all the info (maybe in a logfile) you could parse the output (awk?) and produce the stats you need.

For cpu and memory usage you can have a look at vmstat command, for disks try iostat. However, maybe there's a better utility which I don't know that can do it all :slight_smile:

Use sar

NAME
     sar - system activity reporter

SYNOPSIS
     sar [-aAbcdgkmpqruvwy] [-o filename] t [n]

     sar [-aAbcdgkmpqruvwy] [-e time] [-f filename]  [-i sec]  [-
     s time]

DESCRIPTION
     In the first instance, the sar  utility  samples  cumulative
     activity  counters in the operating system at n intervals of
     t seconds, where t should be 5 or greater. If t is specified
     with  more than one option, all headers are printed together
     and the output can be difficult to read.  (If  the  sampling
     interval  is  less  than  5,  the activity of sar itself can
     affect the sample.) If the -o option is specified, it  saves
     the  samples in filename in binary format. The default value
     of n is 1.

     In the second instance, no sampling interval  is  specified.
     sar  extracts  data  from  a  previously  recorded filename,
     either the one specified by the -f option  or,  by  default,
     the    standard    system    activity    daily   data   file
     /var/adm/sa/sadd for the current day dd.  The  starting  and
     ending  times  of the report can be bounded using the -e and
     -s arguments with time specified in the  form  hh[:mm[:ss]].
     The  -i option selects records at sec second intervals. Oth-
     erwise, all intervals found in the data file are reported.

man sar for full details

mpstat - for processor
vmstat - for Virtual memory
iostat - for I/O
sar - for processor activities
top - for process wise CPU usage

sar is a much better tool then vmstat and iostat for gathering performance information over time..
There's some info on sar here and here. Look at the man page aswell, its a very usefull tool once you learn how to use it.

If you don't have top, you can use prstat -a... About the same type of output, just without all the nice bells and whistles. :slight_smile: