SAR:(System Activity Reporter)
SAR is a legacy system monitoring tool which is used to report CPU activity, system loads average, memory/paging, LUN load, network activity.We can add SAR in crontab to monitor the server through out the day and this will help you to find the system disk I/O,memory utilization,CPU utilization any given time.Once you have the sar output files, you can use ksar graphical tool to make awesome graph.
Here we will see how to activate the SAR on Solaris 10.
Schedule the SAR reports via crontab:
To run those scripts regularly during the business hours , we need to enable the three lines, in the crontab of the user sys:
# crontab -l 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
This writes a record to /var/adm/sa/sa<dd> on the hour, every hour, seven days a week.
# sar -f /var/adm/sa/sa12 SunOS mygz 5.10 Generic_144500-19 sun4u 07/12/2012 00:00:46 %usr %sys %wio %idle 01:00:19 29 43 0 29 02:01:07 38 41 0 21 03:01:00 38 40 0 23 04:00:40 24 38 0 38 05:00:37 19 37 0 44 06:00:53 14 34 0 51 07:00:47 8 32 0 59 08:00:46 8 33 0 59 08:20:09 35 42 0 23 08:40:07 15 35 0 50 09:00:45 11 33 0 56 09:20:09 11 33 0 56 09:40:05 11 33 0 56 10:00:42 9 33 0 58 10:20:11 10 33 0 57 10:40:06 9 33 0 58 11:00:51 10 34 0 56 11:20:08 16 35 0 49 11:40:10 17 35 0 49 12:00:37 24 50 0 26 12:20:15 16 49 0 35 12:40:08 16 47 0 37 Average 20 37 0 43
# sar -r -f sa12 SunOS unixarena1 5.10 Generic_147147-26 sun4u 03/09/2013 00:00:03 freemem freeswap 00:05:02 17158345 800239210 00:10:03 16997085 796846363 00:15:02 17030902 797477396 00:20:03 17085893 797904230 00:25:02 17013282 797736864 00:30:03 17087080 798849105 00:35:02 17109713 798723614 00:40:03 17079375 798843148 00:45:04 17096308 799010576 Average 18815342 825094432
How to install and activate SAR on Solaris 11 & zones ?
1. Use “pkg search” to find the package name.
root@UA-SOL11:~# pkg search '/usr/bin/sar' INDEX ACTION VALUE PACKAGE path link usr/bin/sar pkg:/system/accounting/legacy-accounting@0.5.11-0.175.1.2.0.2.2
2. Install the package using “pkg install” .
root@UA-SOL11:~# pkg install pkg:/system/accounting/legacy-accounting@0.5.11-0.175.1.2.0.2.2 Packages to install: 1 Create boot environment: No Create backup boot environment: No Services to change: 1 DOWNLOAD PKGS FILES XFER (MB) SPEED Completed 1/1 144/144 0.2/0.2 50.1k/s PHASE ITEMS Installing new actions 190/190 Updating package state database Done Updating image state Done Creating fast lookup database Done The following unexpected or editable files and directories were salvaged while executing the requested package operation; they have been moved to the displayed location in the image: var/spool/cron/crontabs/sys -> /var/pkg/lost+found/var/spool/cron/crontabs/sys-20160113T123511Z root@UA-SOL11:~#
3. Update the crontab for user “sys”.
root@UA-SOL11:~# crontab -e sys #ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */ # # The sys crontab should be used to do performance collection. See cron # and performance manual pages for details on startup. # 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 ~
4. Make sure that user “sys” is present in /etc/cron.d/cron.allow but not in cron.deny.
You should be able these the performance statistics collections with the configured interval.
ROHIT KUMAR SINGH says
No updates necessary for this image.