How do I get sar to show for specific dates?

ErezN picture ErezN · May 15, 2016 · Viewed 10.6k times · Source

I am trying to display sar (CPU metrics) metrics between specific dates and I don't know exactly how it should be done.

any help would be great thanks!

Answer

Denis Leger picture Denis Leger · May 15, 2016

As far as I know, there is no specific option to get a result between 2 dates.

HOWEVER:

1) sysstat put logs usually in /var/log/sysstat/ or /var/log/sa/. Then the files numbered here should correspond to the day of the month, so, sa01 should be the 1rst day of the month

2) You can read the raw data using the sar command: example: sar -f sa01

3) you can't choose to read from a date to another date, but you can select a start time to an end time, using -s and -e options.

Playing with this, with a minimum of scripting, you should be able to have a solution to your problem.

Hope it will help!