1832751 Members
2626 Online
110045 Solutions
New Discussion

Re: SAR

 
Luis Lino_1
Advisor

SAR

Hi, we have set in /var/spool/cron/crontabs/root the following lines:

0 * * * 0,6 /usr/lbin/sa/sa1

0 8-17 * * 1-5 /usr/lbin/sa/sa1 1200 3

0 18-7 * * 1-5 /usr/lbin/sa/sa1

5 18 * * 1-5 /usr/lbin/sa/sa2 -s 8:00 -e 18:01 -i 3600 -u

5 18 * * 1-5 /usr/lbin/sa/sa2 -s 8:00 -e 18:01 -i 3600 -b

5 18 * * 1-5 /usr/lbin/sa/sa2 -s 8:00 -e 18:01 -i 3600 -q

but the system only keep the information for ten days, but we need more days, somebody help me, please, thanks!
7 REPLIES 7
Abdul Rahiman
Esteemed Contributor

Re: SAR

I think the removal of old sar files are controlled by the sa2 script. By default it will delete files older than a week.

Try editing the /usr/lbin/sa/sa2 script and change the +7 in the find command at the end, to the number of day's worth of data you want to keep. eg(+14 for two weeks).

regds,
Abdul.
No unix, no fun
Sundar_7
Honored Contributor

Re: SAR

why would you use both sa1 and sa2 ? - I guess both collect the same data.

It could be because lack of space in /var/adm/sa file system.

I believe the first 3 entries will suffice to record all the activities.
Learn What to do ,How to do and more importantly When to do ?
Sundar_7
Honored Contributor

Re: SAR

Yes Abdul was right on.

sa2 script has the following entry

find /var/adm/sa \( -name 'sar*' -o -name 'sa*' \) -mtime +7 -exec rm {} \;

that deletes files older than 7 days.

Just schedule only the first 3 jobs.
Learn What to do ,How to do and more importantly When to do ?
Jeff Schussele
Honored Contributor

Re: SAR

Hi Luis,

Check cron for any file trimming jobs.
sa1, sa2 & sadc should keep files in /var/adm/sa/saDD where DD is day of the month & will be held until it's overwritten by the next month's entry.
I'd also check the cron log to see if the job(s) are possibly failing.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Sridhar Bhaskarla
Honored Contributor

Re: SAR

Hi,

Actually you don't need to run sa2 command unless you want the reports to be generated automatically in which case you can follow the above suggestions. It does nothing but to run sar command with -f option. So anytime you want a report, you can get it using the command

sar -f /var/adm/sa/sa > your_outfile

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Rick Garland
Honored Contributor

Re: SAR

The sa2 will convert the binary output to an ascii output that you can be human readable.

You can put in info that tells sa2 to only keep a certain number of days. It can also be somewhere else that says only keep so many days of these files.

Here is a script I have used that will keep these ascii outputs by months indefinitely (unless there is a specific job to do the cleaning).

Put this in cron and run at 2357 hrs nightly.

#!/bin/ksh

set `date +'%d %b %Y'`
DAY=$1
MONTH=$2
YEAR=$3
DATE=$DAY$MONTH$YEAR
PERF_HOME=/var/adm/sa/perf

if [ -d $PERF_HOME/$YEAR ]
then
echo "directory exists" > /dev/null
else
mkdir $PERF_HOME/$YEAR
fi
if [ -d $PERF_HOME/$YEAR/$MONTH ]
then
echo "directory exists" > /dev/null
else
mkdir $PERF_HOME/$YEAR/$MONTH
fi

# cpu report
/usr/lbin/sa/sa2 -i 300
mv /var/adm/sa/sar`date +\%d` $PERF_HOME/$YEAR/$MONTH/cpu.$DATE

# buffer cache report
/usr/lbin/sa/sa2 -b -i 300
mv /var/adm/sa/sar`date +\%d` $PERF_HOME/$YEAR/$MONTH/bufcache.$DATE

# disk activity report
/usr/lbin/sa/sa2 -d -i 300
mv /var/adm/sa/sar`date +\%d` $PERF_HOME/$YEAR/$MONTH/diskio.$DATE

# inode, test, and process report
/usr/lbin/sa/sa2 -v -i 300
mv /var/adm/sa/sar`date +\%d` $PERF_HOME/$YEAR/$MONTH/inode.$DATE

# semaphore report
/usr/lbin/sa/sa2 -m -i 300
mv /var/adm/sa/sar`date +\%d` $PERF_HOME/$YEAR/$MONTH/semaphore.$DATE

# swap report
/usr/lbin/sa/sa2 -w -i 300
mv /var/adm/sa/sar`date +\%d` $PERF_HOME/$YEAR/$MONTH/swap.$DATE
Luis Lino_1
Advisor

Re: SAR

Thanks, we have changed sa2 script and our system is working ok.