• 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. “Warning: Missing charsets in String to FontSet conversion” – how to resolve the xclock warning message
  2. Determining which network interface will be used for jumpstart installation / network boot
  3. The ultimate Solaris CRON troubleshooting guide
  4. How to run savecore (crash dump) manually in Solaris
  5. Solaris Resource Manager Basics : Understanding Resource Pools
  6. Unix file basics : Inode, Soft Vs Hard link, Device files, Named pipes
  7. Solaris 10 zones troubleshooting : Unable to Share NFS File Systems From a Non-global Zone
  8. How to find Number of Physical/Logical CPUs, cores and memory in Solaris
  9. How to add Additional Storage Space Created from Dynamic LUN Expansion in ZFS online
  10. Solaris : How to automate scp transfer (using passwordless ssh)

You May Also Like

Primary Sidebar

Recent Posts

  • JavaFX ComboBox: Set a value to the combo box
  • Nginx load balancing
  • nginx 504 gateway time-out
  • Images preview with ngx_http_image_filter_module

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright