Your Doorstep to the Temple of Oracle

Oracle EBS

Sar Command in Linux

Posted by appsdba11i on May 8, 2011

The sar command writes to standard output the  contents  of  selected
cumulative  activity counters in the operating system. The accounting
system, based on the values in the  count  and  interval  parameters,
writes information the specified number of times spaced at the speci-
fied intervals in seconds.  If the interval parameter is set to zero,
the  sar  command  displays the average statistics for the time since
the system was started.

How it Works
The sysstat crontab invokes a shell script, sa1, which in turn calls a program named sadc (System Activity Data Collector) which gathers data samples on CPU, memory, io, and network devices, creating a snapshot of system performance for that moment in time. The data is written out, in a binary format, to /var/log/sa/saXX where the XX is the two digit day of the month. This scheme allows for the files to be overwritten as the month rolls over, so if they need to be archived, set up a shell script to rotate them elsewhere. Also, be aware that, on Red Hat at least, the /usr/lib/sa/sa2 script which creates the daily summaries each night, also removes any sar data files older than 7 days. This is configurable in /etc/sysconfig/sysstat.

Basic Usage
The sar program is invoked by the user. When called without the -f (file) option, it reads the file in /var/log/sa for today. When called with no options or arguments, sar gives us a nice little summary of CPU activity.

Simple points


+  It will store 30 days of files(like cpu,i/o,swap ,mem usage in files), by  which we  can see the cpu usage of parcticular  for that day(old days)

+files will be stored in /var/log/sa

Usage : sar -f filename

To find present CPU usgae


sar 2 3
sar -u 2 3
sar -r 3 3
sar -u
sar -f


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: