AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
 View Only
  • 1.  How to Launch Sar automatically at boot up -or-cronjob

    Posted Tue June 26, 2012 06:13 PM

    Originally posted by: michaelsteele


    How to Launch Sar automatically at boot up -or-cronjob
    #AIX-Forum


  • 2.  Re: How to Launch Sar automatically at boot up -or-cronjob

    Posted Tue June 26, 2012 07:10 PM

    Originally posted by: dukessd


    stick it in your inittab or crontab, simple!
    #AIX-Forum


  • 3.  Re: How to Launch Sar automatically at boot up -or-cronjob

    Posted Wed June 27, 2012 12:59 AM

    Originally posted by: SystemAdmin


    Hi,

    On the user adm, there is a crontab with all entries not apply.
    You can choose an action
    #AIX-Forum


  • 4.  Re: How to Launch Sar automatically at boot up -or-cronjob

    Posted Wed June 27, 2012 09:30 AM

    Originally posted by: michaelsteele


    Duke / Biblio:

    Keeping a month of sar data in /var/adm/sa is a little more complicated than executing a 5 minute sar command. The report names change from day to day.

    So if you want full credit I'llneed to see something more than a six word comment.
    #AIX-Forum


  • 5.  Re: How to Launch Sar automatically at boot up -or-cronjob

    Posted Wed June 27, 2012 01:03 PM

    Originally posted by: SystemAdmin


    Hi

    Example for 1 month of history of performances collects with sar
    1. su - adm
    $ crontab –l = is default entries in AIX : all entries are disabled (#)

    #=================================================================
    1. SYSTEM ACTIVITY REPORTS
    2. 8am-5pm activity reports every 20 mins during weekdays.
    3. activity reports every an hour on Saturday and Sunday.
    4. 6pm-7am activity reports every an hour during weekdays.
    5. 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

    1. cd /var/adm/sa
    2. 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
    1. chmod o+x /usr/lib/sa/sadc

    #AIX-Forum


  • 6.  Re: How to Launch Sar automatically at boot up -or-cronjob

    Posted Thu June 28, 2012 12:48 PM

    Originally posted by: michaelsteele


    I don't see anywhere to assign points for the solution?
    #AIX-Forum