Search Posts on Binpipe Blog

Monitor with SAR command in Linux

How to Check Queue Activity (sar -q)

  1. Use the sar -q command to report the following information:

    • The Average queue length while the queue is occupied.

    • The percentage of time that the queue is occupied.


    $ sar -q  00:00:00 runq-sz %runocc swpq-sz %swpocc

    The following list describes the output from the -q option.

    runq-sz

    The number of kernel threads in memory that are waiting for a CPU to run. Typically, this value should be less than 2. Consistently higher values mean that the system might be CPU-bound.

    %runocc

    The percentage of time that the dispatch queues are occupied.

    swpq-sz

    Swap queue of processes for the sar command.

    %swpocc

    Swap queue of processes for the sar command.

    How to Check Unused Memory (sar -r)

  2. Use the sar -r command to report the number of memory pages and swap-file disk blocks that are currently unused.


    $ sar -r  00:00:00 freemem freeswap  01:00:00    2135   401922

    The following list describes the output from the -r option:

    freemem

    The average number of memory pages that are available to user processes over the intervals sampled by the command. Page size is machine-dependent.

    freeswap

    The number of 512-byte disk blocks that are available for page swapping.

    How to Check CPU Utilization (sar -u)

  3. Use the sar -u command to display CPU utilization statistics.


    $ sar -u  00:00:00    %usr    %sys    %wio   %idle  01:00:00       0       0       0     100

    The sar command without any options is equivalent to the sar -u command. At any given moment, the processor is either busy or idle. When busy, the processor is in either user mode or system mode. When idle, the processor is either waiting for I/O completion or “sitting still” with no work to do.

    The following list describes output from the -u option:

    %usr

    Lists the percentage of time that the processor is in user mode.

    %sys

    Lists the percentage of time that the processor is in system mode.

    %wio

    Lists the percentage of time that the processor is idle and waiting for I/O completion.

    %idle

    Lists the percentage of time that the processor is idle and not waiting for I/O.

    A high %wio value generally means that a disk slowdown has occurred

    How to Check System Table Status (sar -v)

  4. Use the sar -v command to report the status of the process table, inode table, file table, and shared memory record table.


    $ sar -v  00:00:00  proc-sz    ov  inod-sz    ov  file-sz    ov   lock-sz  01:00:00   43/922     0 2984/4236    0  322/322     0    0/0   

How to Check Swapping Activity (sar -w)

  1. Use the sar -w command to report swapping and switching activity.


    $ sar -w  00:00:00 swpin/s bswin/s swpot/s bswot/s pswch/s  01:00:00    0.00     0.0    0.00     0.0      22

    The following list describes target values and observations related to the sar -w command output.

    swpin/s

    The number of LWP transfers into memory per second.

    bswin/s

    The number of blocks transferred for swap-ins per second. /* (float)PGTOBLK(xx->cvmi.pgswapin) / sec_diff */.

    swpot/s

    The average number of processes that are swapped out of memory per second. If the number is greater than 1, you might need to increase memory.

    bswot/s

    The number of blocks that are transferred for swap-outs per second.

    pswch/s

    The number of kernel thread switches, per second.


    Note –

    All process swap-ins include process initialization.


How to Check Terminal Activity (sar -y)

  1. Use the sar -y command to monitor terminal device activities.


    $ sar -y  00:00:00 rawch/s canch/s outch/s rcvin/s xmtin/s mdmin/s  01:00:00       0       0       0       0       0       0

    If you have a lot of terminal I/O, you can use this report to determine if any bad lines exist. The activities recorded are defined in the following list.

    rawch/s

    Input characters (raw queue) per second.

    canch/s

    Input characters that are processed by canon (canonical queue) per second.

    outch/s

    Output characters (output queue) per second.

    rcvin/s

    Receiver hardware interrupts per second.

    xmtin/s

    Transmitter hardware interrupts per second.

    mdmin/s

    Modem interrupts per second.

    The number of modem interrupts per second (mdmin/s) should be close to zero. The receive and transmit interrupts per second (xmtin/s and rcvin/s) should be less than or equal to the number of incoming or outgoing characters, respectively. If not, check for bad lines.

    How to Check Overall System Performance (sar -A)

  2. Use the sar -A command to display statistics from all options to provide a view of overall system performance.

    This command provides a more global perspective. If data from more than a single time segment is shown, the report includes averages.

    How to Set Up Automatic Data Collection

  3. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands.

  4. Run the svcadm enable system/sar:default command.

    This version of the sadc command writes a special record that marks the time when the counters are reset to zero (boot time).

  5. Edit the /var/spool/cron/crontabs/sys crontab file.


    Note –

    Do not edit a crontab file directly. Instead, use the crontab -e command to make changes to an existing crontab file.



    # crontab -e sys  
  6. Uncomment the following lines:


    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

3 comments:

  1. Hello, I enjoy reading through your article
    post. I wanted to write a little comment to support you.

    ReplyDelete
  2. hi!,I really like your writing so so much! percentage we keep in touch more about your post
    on AOL? I require a specialist on this space to solve my problem.
    May be that's you! Taking a look forward to peer you.

    ReplyDelete
  3. Hello, of course this paragraph is genuinely fastidious and
    I have learned lot of things from it regarding blogging.
    thanks.

    ReplyDelete

Hi, Leave a comment here and one of the binary piper's will reply soon :)