JP Vossen on 19 Feb 2009 22:05:20 -0800

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] sar output analysis?

I'm using output from various sar commands to take a wild-assed-guess 
(WAG) at sizing some VMware guest VMs for disk size, RAM and CPU.

Does anyone know of any sar output analyzers that might be of some use? 
  I've got some (really, really ugly) Perl going, but it's turning out 
to be a larger and more tedious project than I expected.

I'm aware that since my output is not quite normal, I'll have some 
issues using anything stock.  But I might be able to munge my current 
data back into "expected" format, or just get some ideas from the code 
or presentation of any tools anyone suggests.

FWIW, here is a fragment of how I collected the data.  Unfortunately, I 
forgot 'sar -n EDEV' (NIC errors) and it is non-trivial to re-run for 
various reasons too boring to detail.

As you can see I'm only collecting the sar averages, and I'm also 
prepending each line with the date, hostname and a keyword so the data 
files are reasonably easy to parse later.

----- begin fragment -----

# Read every sar log file available
for sar_file in $sa_path/sa??; do

     [trimmed stuff]

     # CPU Stats
     sar -u     -f $sar_file | grep '^Average' \
       | while read i; do echo -e "$date\t$host\tCPU\t$i"; done

     # NIC stats
     sar -n DEV -f $sar_file | egrep '^Average:[[:space:]]+eth' \
       | while read i; do echo -e "$date\t$host\tNIC\t$i"; done

     # NIC ERROR stats
#    sar -n EDEV -f $sar_file | egrep '^Average:[[:space:]]+eth' \
#      | while read i; do echo -e "$date\t$host\tNIC_err\t$i"; done

     # Disk stats
     sar -dp    -f $sar_file | grep '^Average' \
       | while read i; do echo -e "$date\t$host\tDisk\t$i"; done

     # Memory stats
     sar -r     -f $sar_file | grep '^Average'\
       | while read i; do echo -e "$date\t$host\tRAM\t$i"; done


# Get Disk space too
date="$(date '+%x')"
df -klT | egrep -v '^udev|^tmpfs' \
   | while read i; do echo -e "$date\t$HOSTNAME\tDisk_Space\t$i"; done

----- end fragment -----

JP Vossen, CISSP            |:::======|
My Account, My Opinions     |=========|
"Microsoft Tax" = the additional hardware & yearly fees for the add-on
software required to protect Windows from its own poorly designed and
implemented self, while the overhead incidentally flattens Moore's Law.
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --