1833788 Members
2248 Online
110063 Solutions
New Discussion

Re: sar

 
SOLVED
Go to solution
Katie Sands
Occasional Advisor

sar

Attempting to set up sar. Any helpful hints before I get started?
11 REPLIES 11
Steven E. Protter
Exalted Contributor

Re: sar

Attaching a good sar script.

It comes with the os.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Robert-Jan Goossens
Honored Contributor

Re: sar

Hi Katie,

Check this doc,

http://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000062922500

Document description:
How to setup sar(1m) within cron to collect data .

Document id: UPERFKBRC00010252

Regards,
Robert-Jan.
Katie Sands
Occasional Advisor

Re: sar

ok. I read sa1 man page and found that /usr/lbin/sa/sadc needs to be added to a system start up script. This lead me to 10.0 File System Layout White Paper, which told me to add to /sbin/init.d and name it after the subsystem it controls (sar, I assume?). I guess I am missing the details of the how-to. Any more pointers? Thx.
Stuart Abramson_2
Honored Contributor

Re: sar


1. To set it up:

Start sar:
cd /root/doc
crontab -l > crontab.mmdd
vi crontab.mmdd
add:
0 * * * * /usr/lib/sa/sa1 600 6
crontab < cron.mmdd
crontab -l
mkdir /var/adm/sa

2. To use it:

a. The sar collector puts data in:

/var/adm/sa/

in files named: saNN

sa01
sa02

where NN is the day of the month on which the data was collected.


abramsd@adedd09p:/var/adm/sa$ ll
total 294718
-rw-r--r-- 1 root sys 5810240 Oct 1 23:50 sa01
-rw-r--r-- 1 root sys 6243840 Oct 2 23:50 sa02
-rw-r--r-- 1 root sys 6243840 Oct 3 23:50 sa03
-rw-r--r-- 1 root sys 6243840 Oct 4 23:50 sa04
-rw-r--r-- 1 root sys 5723520 Oct 5 23:50 sa05
-rw-r--r-- 1 root sys 6243840 Oct 6 23:50 sa06
-rw-r--r-- 1 root sys 6113760 Oct 7 23:50 sa07
-rw-r--r-- 1 root sys 3382080 Oct 8 12:50 sa08
-rw-r--r-- 1 root sys 3409920 Sep 10 00:50 sa09
-rw-r--r-- 1 root sys 3409920 Sep 11 00:50 sa10
-rw-r--r-- 1 root sys 3409920 Sep 12 00:50 sa11
-rw-r--r-- 1 root sys 3409920 Sep 13 00:50 sa12
-rw-r--r-- 1 root sys 3409920 Sep 14 00:50 sa13
-rw-r--r-- 1 root sys 780480 Oct 14 23:50 sa14

b. To find out table space usage on ANY system right now:

sar -v 5 5

c. To get a 24 hour history of today:

sar -v

d. To get a 24 hour history of October 8:

sar -v -f /var/adm/sa/sa08

3. Maintenance:

a. The files in /var/adm/sa write over after 30 days:

October 1 was written on sa01
November 1 will overwrite sa01

b. You might want to put something in place to wipe out 2 week old files:

find /var/adm/sa -mtime +15 -exec rm {} \;


Geoff Wild
Honored Contributor

Re: sar

That depends on your environment....

Add the following to root's cron:

# SAR
0 * * * 0-6 /usr/lib/sa/sa1
10,20,30,40,50 5-19 * * 1-5 /usr/lib/sa/sa1
5 18 * * 1-5 /usr/lib/sa/sa2 -s 5:00 -e 19:01 -i 600 -A


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Katie Sands
Occasional Advisor

Re: sar

Does I have to be in /root/doc? B/c it does not exist on my system. Do I need to create it?
Katie Sands
Occasional Advisor

Re: sar

This what I ended up adding in /usr/spool/cron/crontabs/root:

#collect sar data
0 * * * * /usr/lbin/sa/sa1
20,40 8-17 * * 1-5 /usr/lbin/sa/sa1
#reduce the sar data
5 18 * * * /usr/lbin/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A

Thanks for your help. You definitely sent me in the right direction.
Stuart Abramson_2
Honored Contributor
Solution

Re: sar

Katie:

I NEVER vi /usr/spool/cron/crontabs/root.

Your crontab change won't register if you vi this file.

pick a scratch directory, anywhere. I use /root/doc to keep stuff that I want.

cd /scratch_place
crontab -l > cron.MMDD
vi cron.MMDD
.....make appropriate changes
crontab < cron.MMDD

Now look at /usr/spool/cron/crontabs/root. It will have been changed by the "crontab < file".
Katie Sands
Occasional Advisor

Re: sar

Thank you!!!
Katie Sands
Occasional Advisor

Re: sar

I did a cat on sa04 and it spits out a bunch of garbage. Here is my entry in file cron.1104 ----

more cron.1104
# SAR
0 * * * 0-6 /usr/lib/sa/sa1
10,20,30,40,50 5-19 * * 1-5 /usr/lib/sa/sa1
5 18 * * 1-5 /usr/lib/sa/sa2 -s 5:00 -e 19:01 -i 600 -A

Is there anything else I am missing in my set up?
Katie Sands
Occasional Advisor

Re: sar

Nevermind.