cancel
Showing results for 
Search instead for 
Did you mean: 

sar output

Waugh
Frequent Advisor

sar output

Hi

how to check the prevous day sar output.what is the syntax for it

Regards
Rkumar
4 REPLIES
Ganesan R
Honored Contributor

Re: sar output

Hi,

look these files /var/adm/sa/saxx where xx is two digits representing the date.
Best wishes,

Ganesh.

Re: sar output

Ganesan gas given a hint... you will find that you cannot get historical data out of sar, unless someone has taken the time to setup accounting on your system. Once setup you just use sar in the same way as you would normally execpt instead of giving a number of iterations and sample interval, you specificy the file to use (hwich is based on the day of the month).

So if today is 12 May, and you want to look at yesterday's sar data for cpu utilization instead of:

sar -u 2 10

you would do:

sar -u -f /var/adm/sa/sa11

To setup accounting in the first place - carry out the following steps:

-Create the following directory, owned by user adm

/var/adm/sa

-Make sure user adm is allowed to use cron and add the following entried to the file /var/spool/cron/crontabs/adm

# adm crontab file for
#
# Run Daily Accounting
0 4 * * 1-6 /usr/sbin/acct/runacct 2> /var/adm/acct/nite/fd2log
#
# Check size of /var/adm/pacct
0 * * * * /usr/sbin/acct/ckpacct
#
# Create summary files
15 5 1 * * /usr/sbin/acct/monacct
#
# Collect system accounting information and store in binary format
0 7-17 * * * /usr/lib/sa/sa1 1200 3
#
# Write a daily report to /var/adm/sa/sadd (where dd is day number)
0 18 * * 1-6 /usr/lib/sa/sa2 -s 7:00 -e 18:01 -i 3600 -A
#
# Disk Accounting
0 2 * * 4 /usr/sbin/acct/dodisk

-Remove all comments from /etc/fstab, as some of the accounting tools can't process them

-Set flag to 1 in /etc/rc.config.d/acct, as follows:

START_ACCT=1

-Comment out â dateâ commands in the /usr/sbin/acct/dodisk script - otherwise you get a pointless email from cron to the adm account every day with the date in it.

-Set up /etc/acct/holidays for the current year. You need to figure out the "day of the year" for every public holiday where you are...

After this has been done, and the scripts have been allowed to run for >24 hours, you will start to see data in /var/adm/sa

HTH

Duncan

HTH

Duncan
Frank de Vries
Respected Contributor

Re: sar output

Beware:
provided you have a scheduled crontab job
00 * * * * /usr/lib/sa/sa1 1200 3

the syntax is

sar -f /var/adm/sa/sadd
(where dd is the day dd)

Without the -f it reads the current day

If you do not have the cronjob, then
sar data is not stored, then you
cannot retrieve it either.
Look before you leap
Suraj K Sankari
Honored Contributor

Re: sar output

Hi,
1st you need to take sar output into a file see the example

The following command stores system activity data in a file /home/root/sar.data 360 times,
once every 10 seconds (total time one hour).
#sar -o /home/root/sar.data 10 360

This file can be analyzed later by using the following command.
#sar -f /home/root/sar.data

Suraj