What is SAR?

Sar
is a monitoring tool used by server administrator to monitor server resource usages. Lots of command line tools are available to monitor server resource usages.Sar is one of them and is a part of sysstat package. We can collect informantions based on CPU, Memory, I/O etc in real time.



A lot of switches are available with “sar” command to check different things. In debian based server, command “apt-get” is used to install the SAR utility.



Installation of SAR on Ubuntu/Debian:



Step I : SSH to the server as root user.

Step II : Execute the below command to install the SAR utility.

# apt-get install sysstat

 

Note:

You might get the below pasted error if you are not configured the sysstat properly.

Cannot open /var/log/sysstat/sa02: No such file or directory
Please check if data collecting is enabled in /etc/default/sysstat

 

How to Fix it?

Open “/etc/default/sysstat” using your favorite file editor and change ENABLED=”false” to ENABLED=”true”

vi /etc/default/sysstat
--------------------------
# Should sadc collect system activity informations? Valid values
# are "true" and "false". Please do not put other values, they
# will be overwritten by debconf!
ENABLED="true"

 

Step III : One more thing to do, change the collection interval from every 10 minutes to every 2 minutes.

----
vi /etc/cron.d/sysstat
Change
5-55/10 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1
To
*/2 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1
----

Step IV : Restart the service.

service sysstat restart
Or
/etc/init.d/sysstat restart

 

Sar has been installed succeesfully!!!!

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)