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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • 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. How to remove a failed disk using luxadm and cfgadm
  2. Troubleshooting Solaris IPMP
  3. Solaris Zones : How To Change The Number Of CPUs Using Dynamic Resource Pools
  4. How to Disable IPv6 in solaris 8,9,10
  5. How to prevent non-root user from creating crontab entry
  6. Script for finding the process using a specific port in Solaris
  7. Solaris 11 : Setting user and group quota for ZFS datasets
  8. Installing Oracle solaris 11 in Virtualbox
  9. How to enable or disable telnet in Solaris 10
  10. Beginners Guide to Configuring network virtualization features in Solaris 11

You May Also Like

Primary Sidebar

Recent Posts

  • nixos-rebuild Command Examples in Linux
  • nixos-option: Command Examples in Linux
  • nixos-container : Command Examples in Linux
  • nitrogen Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright