Monday, March 3, 2014

How to enable SAR (System Activity Reporter) on Solaris 10

This artical about to enable SAR (System Activity Reporter) on Solaris 10, here I am providing step by step details to enable it.

Some of the key points to enable SAR:

1). It will help us to troubleshoot performance issue
2). Through SAR utility we can troubleshoot i.e DISK/MEMORY/CPU performance issue

Disadvantage to enable SAR:

1). It will consume more space to capture SAR 
2). Usually it will fill space on /var FS

Step by step procedure to enable SAR: 

Solaris 10 has SMF (Solaris Management Facility), which will help us to manage all the services.
Check SAR service is enabled:
[root@tpt01]# svcs -a | grep -i sar
disabled        Jul_10   svc:/system/sar:default
[root@tpt01]#
Above output shows SAR service is disabled so enable it :
[root@tpt01]# svcadm enable svc:/system/sar:default
[root@tpt01]#
Check detailed whether SAR service is enabled or not:
[root@tpt01]# svcs -x svc:/system/sar:default
svc:/system/sar:default (system activity reporting package)
 State: online since March 1, 2014 12:36:38 PM EDT
   See: sar(1M)
   See: /var/svc/log/system-sar:default.log
Impact: None.
[root@tpt01]#
Set Up Automatic Data Collection:

 /usr/lib/sa/sa1 = a shell script to collect and store data in the binary file /var/adm/sa/sadd, where dd is the current day
 /usr/lib/sa/sa2 = a shell script that writes a daily report in the file /var/adm/sa/sardd

To run these scripts regularly, we need to add below three lines in the crontab for sys user

Edit the /var/spool/cron/crontabs/sys crontab file. Note - Do not edit a crontab file using VI editor. Instead of use crontab -e command to make changes.
[root@tpt01]# crontab -e sys
0 * * * 0-6 /usr/lib/sa/sa1
20,40 8-17 * * 1-5 /usr/lib/sa/sa1
5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A
[root@tpt01]#
The sys crontab entries do the following:

The first two crontab entries cause a record to be written to the /var/adm/sa/sadd file every 20 minutes from 8 a.m. to 5 p.m., Monday to Friday, and every hour on the hour otherwise.
The third entry writes a record to the /var/adm/sa/sardd file hourly, Monday to Friday, and includes all SAR options.

Now the SAR - System Activity Reporter is running every day.

Thanks for reading this post.


0 comments:

Post a Comment