• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to set up cron for automatic data collection from the system activity reporter (SAR) in Solaris 10 and 11

By admin

This post outlines steps to set up a cron job for automatic data collection from system activity reporter (aka SAR).

Prior to Solaris 10

1. Become the superuser.

2. Edit the following file:

# vi /etc/init.d/perf

3. Uncomment the following lines (remove the # sign from the beginning of each line):

#if [ -z "$_INIT_RUN_LEVEL" ]; then
#       set -- `/usr/bin/who -r`
#       _INIT_RUN_LEVEL="$7"
#       _INIT_RUN_NPREV="$8"
#       _INIT_PREV_LEVEL="$9"
#fi
#
#if [ $_INIT_RUN_LEVEL -ge 2 -a $_INIT_RUN_LEVEL -le 4 -a \
#    $_INIT_RUN_NPREV -eq 0 -a \( $_INIT_PREV_LEVEL = 1 -o \
#    $_INIT_PREV_LEVEL = S \) ]; then
#
#       /usr/bin/su sys -c "/usr/lib/sa/sadc /var/adm/sa/sa`date +%d`"
#fi

The sadc command creates a daily system activity file called sadd, where dd is the current day of the month. At boot time, the sadc command writes a special record that marks the time when the counters are set to zero.

4. Edit the system crontab file:

# crontab -e sys

5. Uncomment or create the following lines:

0 * * * 0-6 /usr/lib/sa/sa1
20,40 8-17 * * 1-5 /usr/lib/sa/sa1

Here,
– The first entry writes a record to /var/adm/sa/sadd (sa01, sa02, …) on the hour, every hour, seven days a week.
– The second entry writes a record to /var/adm/sa/sadd twice every hour during peak working hours: at 20 minutes and 40 minutes past the hour from 8 am to 5 pm Monday through Friday. Modify this entry as desired.

6. Execute the /etc/init.d/perf script, or reboot the system so that the files are re-read and started.

For Solaris 10 and higher

1. Become superuser.

2. Activate the sar service:

# svcadm enable system/sar

3. Edit the sys crontab file:

# crontab -e sys

4. Uncomment or create the following lines as needed:

0 * * * 0-6 /usr/lib/sa/sa1
20,40 8-17 * * 1-5 /usr/lib/sa/sa1

– The first entry writes a record to /var/adm/sa/sadd (sa01, sa02, …) on the hour, every hour, seven days a week.
– The second entry writes a record to /var/adm/sa/sadd twice every hour during peak working hours: at 20 minutes and 40 minutes past the hour from 8 am to 5 pm Monday through Friday. Modify this entry as desired.

5. Run sar to verify operation.

# sar
SunOS berkeley 5.10 Generic sun4u 03/11/2005
17:35:22       %usr     %sys    %wio     %idle
17:35:22       unix restarts
17:40:00       1         1       0        99
17:50:00       0         1       0        99
Average        0         1       0        99

Filed Under: Solaris, Solaris 11

Some more articles you might also be interested in …

  1. Solaris ZFS : How to Designate Hot Spares in a Storage Pool
  2. Beginners Guide to Solaris 11 Image Packaging System (IPS)
  3. How to add Additional Storage Space Created from Dynamic LUN Expansion in ZFS online
  4. Solaris 11 IPS hand-on LAB – Managing software Packages
  5. How To Use ‘zpool split’ to Split rpool in solaris 11 (x86/x64)
  6. Complete hardware reference : T1000 / T2000 / T5120 / T5140 / T5220 / T5240 / T5440
  7. How to configure an IP address in Solaris 11
  8. Solaris Zone Install Fails With Cpio Error
  9. Solaris ZFS : How to import 2 pools that have the same names
  10. How to set OBP Variables from the ALOM/ILOM

You May Also Like

Primary Sidebar

Recent Posts

  • How to disable ICMP redirects on CentOS/RHEL
  • What are Oracle Key Vault Roles
  • What Is Oracle Key Vault
  • Auditing with Oracle Database Vault Reports
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary