How to use sar command?

No comments

About SAR

This article describes how to use “sar” command  to analyse system performance in Unix and Linux especially Oracle Solaris.We’ll describe sar command and parameters with examples. By  default sar package comes from Oracle Solaris and HP-UX installation but for linux you have to install sysstat package.

Which  performance statistics you can monitor  with  sar  command ?

  • CPU usage and statistics
  • Memory  usage and statistics
  • Swap  usage and statistics
  • I/O activities  for the  system
  • Context  switch statistics
  • Run queue and load  avarage
  • Network statistics
  • Report all data  for a spesific  time

According to sysstat package describtion  it  includes  following system analyze packages;

sar pidstat
iostat sadf

You can monitor system performance in real time and also for the past.Let’s check how to install systat package for all type of linux server:

SAR Installation


Centos/Fedora/Red Hat:


SARAnd also you can get sysstat binary file from this SITE and install them on your server. You can download sysstat binary  file to your  local and put it them to the server with  SFTP .Filezilla can be use for file transfer from your local to server.

After you put sysstat bz file under a directory  then you can apply these commands .Also read install file to check if you need more.But I recommend you to put “enable-install-cron” option while configure .This option  ‘ll create startup file and also cron file for you.(/etc/rc.d/init.d/sysstat)

Enable  data  collection on SAR

Take a  look this  Link.You ‘ll get a script to run on your servers.The script  which added  checks and  performs all changes for you. Please  first  run  script  on your test server then check  if everything is fine then  perform same operation for other servers.

After you enabled sar data collection  it ‘ll collect  all performance data. These  files  will be  located  under  the  directory which I added  below.

Oracle  Solaris:/var/adm/sa



Command  Usage for  a spesific  time:”-s” start time  “-e” end time

Oracle Solaris

  • Service:
  • Crontab:


  • Install  sysstat package
  • Service:

  • Crontab:


  • Be sure  /var/adm/sa  directory exist
  • Crontab:

Use  SAR Command

Oracle  Solaris

Memory  Usage Controls:

  • How  to check  page-out and  memory with sar  for  oracle solaris?
    • There are two  important  parameters  that  you need to check  if system needs  more  memory.
      Observed  high values at the same time for the pgscan/s and  pgfree/s, indicates a memory shortage. Please  run “ps  -elf|grep  -v  grep |egrep ‘PID|page'” and check  number  of cycle  for  page  deamon.
    • “sar  -g” also  shows  information about inodes  recycle  state. Check  if  inodes  being  recycled too quickly.Recycled inodes  can be cause  of  loss of reusable  pages.

  • How  to check Kernel memory usage with sar  for  oracle solaris?

  • How  to check Page-In activity with sar  for  oracle solaris?

  • How to Check Queue Activity with sar  for  Oracle  Solaris?
    • runq-sz:The  number  of  process  waiting for free  Cpu .This value  must be less then 2.

  • How to Check Free  memory  with sar  for  Oracle  Solaris?
    • Freemem:pagesize*Freemem
    • Freeswap:freeswap*512  bytes

  • How to check  swap activity with sar  for  Oracle Solaris?
    • swpot/s:The avarage  number of  process swapped  out. This  is  too critical. You need to check  if  it’s  bigger then “1”. Then  you need to  increase  system memory.

CPU Usage Controls:

  • How to check  Idle  CPU  with sar  for  Oracle Solaris?
    •  “sar -u”  command shows the  processors  is either  busy   or  free.When processor is busy it  means  that  the  processor  is  in either  user mode or system  mode. I  remommend to  check first  idle  cpu if   it’s  too  low  then  check  system mode  or  user mode.
      • %usr:User mode
      • %sys:System  mode
      • %wio:Waiting  for  I/O
      • %idle:Idle  not waiting  for  I/O 

Disk Usage Controls:

  • How to check disk service time  or utulization with sar command  for Oracle Solaris?
    • avserv:Avarage time,in milisecond, that  I/O request wait for  idle  in the queue.
    • avwait :Avarage time,in milisecond, that  I/O request  to be completed  by disk device.This  is importand and  also depends  on your  Storage luns. For  mission critical systems and  SSD disk this  parameter can be  observed  max “10”.


Memory  Usage Controls:

Will be published !



Follow me


I'm a System Engineer with extensive experience and administration skills and works for Interbank Card Center Of Turkey.I provide hardware and software support for the following Unix/Linux and Windows platforms.(Oracle Solaris,HP-UX, Linux, IBM-AIX, Windows Servers)
Follow me
facebooktwittergoogle_pluslinkedinby feather