Archive Your System Activity Reports in Solaris 10
If you want to archive your system activity report (sar) in Solaris 10, you need to do the following:
- Enable sar. By default, sar is not enabled in Solaris.
$ su - # svcs sar STATE STIME FMRI disabled Apr_12 svc:/system/sar:default # svcadm enable sar
- Setup cron job for "sys" account. The default
the "sys" user crontab file is commented out. In this example, we set up sar with 5 minute interval.
# crontab -l sys #ident "@(#)sys 1.5 92/07/14 SMI" /* SVr4.0 1.2 */ # # The sys crontab should be used to do performance collection. See cron # and performance manual pages for details on startup. # # 0 * * * 0-6 /usr/lib/sa/sa1 # 20,40 8-17 * * 1-5 /usr/lib/sa/sa1 # 5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/lib/sa/sa1
- Create a script to copy sar data file to an archive directory and rename it with date information. Ensure this script will be executed just after the last sampling interval, in my case, 23:59.
$ su - # cat /usr/lib/sa/sacp #! /bin/sh PATH=/bin:/usr/bin export PATH DIR=/var/adm/sa ARCHIVE="$DIR/archive" [ ! -d "$ARCHIVE" ] && mkdir $ARCHIVE TARGET="$ARCHIVE/sa`date '+%Y-%m-%d'`" cp $DIR/sa`date '+%d'` $TARGET bzip2 $TARGET # chown root:bin /usr/lib/sa/sacp # chmod 555 /usr/lib/sa/sacp # crontab -l sys #ident "@(#)sys 1.5 92/07/14 SMI" /* SVr4.0 1.2 */ # # The sys crontab should be used to do performance collection. See cron # and performance manual pages for details on startup. # # 0 * * * 0-6 /usr/lib/sa/sa1 # 20,40 8-17 * * 1-5 /usr/lib/sa/sa1 # 5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/lib/sa/sa1 59 23 * * * /usr/lib/sa/sacp
Labels: monitoring, performance, sar, Solaris
0 Comments:
Post a Comment
<< Home