Sar during a test

Hi All,
I am trying to run sar on a Redhat server during a test I am performing for a couple of hours. I would like to get the sar metrics for every second (instead of the regularly set up 10 minute interval in the cron). What is the most efficient way to do this?

Thanks,
Shahzad

What are you trying to do? It's impossible to say what's "most efficient" without knowing what your goals are.

In general, I'd recommend testing sar on your hardware to ensure it can sample that fast. If it takes more than one second to collect a sample, you'd probably be better off sampling ever 2 or even 5 seconds.

If you do need to sample that often, read the man page(s) and other documentation and see if you can limit what is being sampled.

Yes, I am thinking 1 second might be too much for sar, I will go with 30 seconds or even a minute. What I want is a sar data file created for a period of couple of hours while I perform some tests instead of the 10 minute gap the cron job currently is set up for.

If your process runs for a couple of hours, then the sample interval should reflect this, else you will end up with too much details to make a good judgement from.

If you ask it to sample at 30 seconds for 120 repetitions, you will get an hour's data. I suppose you can graph (with Excel or similar) the data:-

sar 30 120 > /tmp/my_sar_output

You will need to consider what options to set for whatever you want to measure.

If you bring the sampling down to a single second, or even two seconds then there is a risk that the sar processing will skew your results, a bit like putting a thermometer in a mug of hot coffee will actually cool it a little and tell you what the temperature has now become, not what it was.

Robin

I think I see what you mean. The 30 seconds I can change to all the way up to 2 minutes if that will reduce the sampling impact of the sar.

To get all the sar data for 2 hours at 30 minute interval and a place graph look on the web for a plae to graph it. I can't post URLs, because I'm a newbie here.

 
sar -Ap 30 240> /tmp/$(hostname).sar

.

Oh, don't forget to configure sar to include disk utilization. It varies on how you do it based on the release, even within a release.

On redhat 5 add the following to /etc/sysconfig/sysstat

SADC_OPTIONS="-d -I"

---------- Post updated at 09:10 AM ---------- Previous update was at 08:19 AM ----------

To graph sar data run

sar -Ap 30 240

and send the output to a file. Then go to Sar Grapher to graph it out. It has mouse overs and zooming, pretty nice.