• 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 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. How to configure Solaris 10 Probe based IPMP
  2. How to delegate SMF management to a non-root user in Solaris
  3. How to configure IPMP in Solaris 11 – Active-Active & Active-Standby
  4. How to set OBP Variables from the ALOM/ILOM
  5. How to Create a Datalink in Non-Global Zone from the Global Zone in Solaris 11
  6. How To Use ‘zpool split’ to Split rpool in solaris 11 (x86/x64)
  7. How to Check Solaris Release and Default Kernel Version
  8. Creating network interface alias for network boot or jumpstart installation at OBP
  9. How to Check and Analyze Memory Usage in Solaris
  10. Complete hardware reference : M3000 / M4000 / M5000 / M8000 / M9000

You May Also Like

Primary Sidebar

Recent Posts

  • “az storage blob” Command Examples (Manage blob storage containers and objects in Azure)
  • “az storage account” Command Examples (Manage storage accounts in Azure)
  • “az sshkey” Command Examples (Manage ssh public keys with virtual machines)
  • “az redis” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright