Tuesday, April 28, 2009

Basic Unix/Linux commands


The prerequisite sar command to work is that sysstat rpm must be loaded into os system.

The source files that are required for sar to work can be found in /usr/lib/sa directory, there are three files sa1, sa2, sadc. the output files of sar command can be found in /var/log/sa/ ( there is one file for each day sar i.e. date mean only dd) and we may see what was the system performance yesterday or past in time.

SAR configuration on open SuSE:

I came to know that the sar command is automatically configured in red hat linux versions but one has to configure in solaris, Open SuSe and HP-UX (not sure).
The following are the simple steps to configure sar in Open SuSE.

1. Login as root or with any user having sudo access
2. Create a crontab entry with following info

0,10,20,30,40,50 * * * * /usr/lib/sa/sa1
0,10,20,30,40,50 * * * * /usr/lib/sa/sa2 -A

The actual binary system performance information of system is created by sadc script.
The sa1 shell script is a wrapper for sadc and we use it in crontab entry.
The sa2 script is used to print a report in ASCII format from sa1 script output file.

The files sa1 used above shows how often we want to take snapshot of system performance data and second line is used to how often you want to create report in human readable format to read.

Wait for some time and you will see the files being created in log directory.

Hope this will help and I personally tried it in Open SuSE and worked... this will also work in Solaris and HP-US with/without minor changes, please comment if any change or modifications.

Top ten overloaded process in unix/linux:

Sometimes we would be required to find the processes causing heavy load on Linux system,
so here is the command that one can use
ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10

the CPU intensive processes can be seen with it.

No comments:

Post a Comment