Operating System - HP-UX
1830340 Members
2256 Online
110001 Solutions
New Discussion

system performance logging by using "sar"

 
SOLVED
Go to solution
KCS_1
Respected Contributor

system performance logging by using "sar"

Hi~

I never have ever said all forumers to saying that hope to keeeping good heath and make many funs on your life, so, I wanna do say like that.

by the way, I really need to get good solution from my question.

I wanna gather my system's performance from today to tomorrow by using "sar" command.however, I didn't get it when I was try to using a sar command on my system such as under.

# sar -u -s 10:12:00 -e 10:14:00 -i 60 -f test

how to logging my system's performance by using sar command??

and

why need /var/adm/sa/sadd file ??

if, you know my problem and found some incorrct options or easy to way best solutions,
let me know..please..

thanks..have a good day!

Easy going at all.
3 REPLIES 3
James Murtagh
Honored Contributor

Re: system performance logging by using "sar"

Hi Patrick,

Very nice of you! :-)

In the form of the command you are running, you are attempting to read from the "test" file, not write to it. This is also where the /var/adm/sa/sa
files come in.

These files are normally produced from a cron job, and log system activity during the time specified. If you wanted to check the CPU utilisation from 01:00 to 05:00 on the 3rd of the month at 60 second intervals, you would use:

# sar -u -s 01:00:00 -e 05:00:00 -i 60 -f /var/adm/sa/sa03

If you wanted to capture the information, as it appears you do, use:

# sar -u -s 10:12:00 -e 10:14:00 -i 60 >> test

However, I don't think you can cross the day boundary, so in this case you will only get stats for 2 minutes today!

Regards,

James.
James Murtagh
Honored Contributor

Re: system performance logging by using "sar"

Hi again Patrick,

Sorry, I am taking rubbish, must be getting tired! If you want to capture the information use the sa1, sa2 or sadc utilities. The flags for these are similar to before.

Please see the sadc man page for full details, and check the examples from you cron job.

Regards,

James.
Stuart Abramson_2
Honored Contributor
Solution

Re: system performance logging by using "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 {} \;