Operating System - HP-UX
1753529 Members
4934 Online
108795 Solutions
New Discussion юеВ

get only average value for multiple sar files

 
SPMK
Occasional Advisor

get only average value for multiple sar files


sar reports are automatically storing in a dir in every predefined times...while "sar -f sarfile" gives value of 5sec*4times, also average at the bottom..now to analyse average value we need to give sar for every files,.
if anyone tells, how to get average value of multiple sar files? will be useful.I need the average value only

Thnz
6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: get only average value for multiple sar files

Shalom,

A different collection script might be helpful.

http://www.hpux.ws/?p=6

Otherwise cut and paste the results into a spreadsheet perhaps.

With a lot of work in shell scripting and string parsing, you might be able to pull results out of these various files and get your averages. It depends on how much work you are weilling to do.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Dennis Handly
Acclaimed Contributor

Re: get only average value for multiple sar files

>how to get average value of multiple sar files?

If the values are in nice colums, awk(1) can find the values and average them.
James R. Ferguson
Acclaimed Contributor

Re: get only average value for multiple sar files

Hi:

Even if the columns wobble, as long as the field of interest is in the same ordinal position, 'awk' will allow you to do real arithmetic. For example, if the field you want to average is in column-3 (one-relative):

# awk '{SUM=SUM+$3;COUNT++};END{printf "Avg = %4.2f\n",SUM/COUNT}' file1 file2 file3 ...

That is, you can specify the multiple files to be read and summarized as arguments to the script.

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: get only average value for multiple sar files

>JRF: as long as the field of interest is in the same ordinal position, awk will allow you to do real arithmetic.

Right. The only problem with multiple files is skipping titles and footers with in-file averages or subtotals.
James R. Ferguson
Acclaimed Contributor

Re: get only average value for multiple sar files

Hi (again):

> Dennis: Right. The only problem with multiple files is skipping titles and footers with in-file averages or subtotals.

...while true, that's simply resolved by matching appropriate patterns and skipping lines representing those entities. Of course, this can apply for single as well as multiple files.

Regards!

...JRF...
SPMK
Occasional Advisor

Re: get only average value for multiple sar files

thank u all who replied