• 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 save sar reports longer than 7 days in Solaris

By admin

It might be necessary to save sar reports longer than 7 days. This post explains the steps to achieve this goal.

The “sa2” is the script that is responsible for writing a summarized daily activity report. The /usr/lib/sa/sa2 has the following entries:

#!/sbin/sh
# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
# All Rights Reserved

# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
# The copyright notice above does not evidence any
# actual or intended publication of such source code.

#ident "@(#)sa2.sh 1.4 98/03/26 SMI" /* SVr4.0 1.4 */
# sa2.sh 1.4 of 5/8/89
DATE=`/usr/bin/date +%d`
RPT=/var/adm/sa/sar$DATE
DFILE=/var/adm/sa/sa$DATE
ENDIR=/usr/bin
cd $ENDIR
$ENDIR/sar $* -f $DFILE > $RPT
/usr/bin/find /var/adm/sa \( -name 'sar*' -o -name 'sa*' \) -mtime +7 -exec /usr/bin/rm {} \;

The “-mtime +7” entry shows that it can only keep 7 days of sar report. Changing the value to something else will keep the record longer than 7 days.

Once done modifying the file, refresh your sar SMF service via:

# svcadm refresh svc:/system/sar:default

Filed Under: Solaris

Some more articles you might also be interested in …

  1. Solaris 11 : How to Verify Kernel Zone Support on a Host
  2. Solaris Volume Manager (SVM) : How to Use Mirrors to Roll Back System Changes
  3. Solaris : How to setup session idle timeout for ssh
  4. A beginners guide to Solaris Multipathing Software (MPxIO or STMS)
  5. Examples of adding static routes in Solaris
  6. How to delegate SMF management to a non-root user in Solaris
  7. Solaris 10 patching with SVM : Traditional method (non-live upgrade)
  8. A beginners guide to Service Management Facility (SMF) in Solaris
  9. What is SUID, SGID and Sticky bit ?
  10. Solaris : How to create processor set (pset) and associate it with a pool

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