Originally posted by: SystemAdmin
Hi
Example for 1 month of history of performances collects with sar
-
su - adm
$ crontab –l = is default entries in AIX : all entries are disabled (#)
#=================================================================
-
SYSTEM ACTIVITY REPORTS
-
8am-5pm activity reports every 20 mins during weekdays.
-
activity reports every an hour on Saturday and Sunday.
-
6pm-7am activity reports every an hour during weekdays.
-
Daily summary prepared at 18:05.
#=================================================================
#0 8-17 * * 1-5 /usr/lib/sa/sa1 1200 3 &
#0 * * * 0,6 /usr/lib/sa/sa1 &
#0 18-7 * * 1-5 /usr/lib/sa/sa1 &
#5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 3600 -ubcwyaqvm &
#=================================================================
Modify the 2 entries in this crontab ( without #)
0 0-23 * * * /usr/lib/sa/sa1 300 12 &
48 23 * * * /usr/lib/sa/sa2 -s 0:00 -e 23:46 -i 900 -ubcwyaqvmr &
First line, it says that every hour, were recorded every 300 seconds (5 minutes) and 12 times (300s*12 = 3600s = 1h) the activity system can be seen with sar with all these options in a file SAXX (xx = No. days).
You can modify the parameters
Second line, at 11:48 p.m., is generated from binary files created, a file with daily sarxx xx = No. of days from 00 to 31, by default, all files in the directory /var/adm/sa.
Moreover, keeping only the binaries + summary of 31 days in the /var/adm/sa/, the default script /usr/lib/sa/sa2 keeps only 7 days.
So changing the script sa2 (via root)
…..
DATE=`/usr/bin/date +%d`
RPT=/var/adm/sa/sar$DATE
DFILE=/var/adm/sa/sa$DATE
ENDIR=/usr/sbin
cd $ENDIR
$ENDIR/sar $* -f $DFILE > $RPT
/usr/bin/find /var/adm/sa \( -name 'sar*' -o -name 'sa*' \) -mtime +7 -exec /usr/bin/rm {} \;
with:
/usr/bin/find /var/adm/sa \( -name 'sar*' -o -name 'sa*' \) -mtime +31 -exec /usr/bin/rm {} \;
Sample files under /var/adm/sa
-
cd /var/adm/sa
-
ls -l
total 1448
-rw-r--r-- 1 adm adm 350326 Apr 22 23:55 sa22
-rw-r--r-- 1 adm adm 366396 Apr 23 09:25 sa23
-rw-r--r-- 1 adm adm 18423 Apr 22 23:48 sar22
The file contains information collected sar22 the day before in ASCII format and searchable via the commands vi or a normal cat (in the form of stanzas per hour with performance statistics, buffer, etc. ..), but the details are displayed increments of 15 minutes
You can then go back on a recording via the sar command
sar-f sa22 (default performance, but can be used with the options of sar-u |-b ... `)
See man sar
A final amendment, only root can use the sar command with argument, which disables other users.
$ sar 1 10
sar: The file access permissions do not allow the specified action.
To allow access to users, you must modify the rights of the file /usr/lib/sa/sadc
-
chmod o+x /usr/lib/sa/sadc
#AIX-Forum