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?
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.
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.