If you’re into linux server administration, then sysstat is a very handy tool to have. It allows you to collect realtime and historical data about your server performance, and it’s readily available on all major linux distribution. What’s written in this blog is based on RHEL 4.7, but it should be applicable to other distros with some minor tweaks.

Packages to install on RHEL 4.7 :

  • sysstat-5.0.5-19.el4.i386.rpm

to install:

[root@localhost RPMS]# rpm -ivh sysstat-5.0.5-19.el4.i386.rpm
warning: sysstat-5.0.5-19.el4.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing...                ########################################### [100%]
 1:sysstat                ########################################### [100%]

The first step that you’ll need to do is to make sure the sysstat is collecting data from your machine. Check the the content of /etc/crond.d/sysstat, it should be similar to this:

[root@localhost /]# more /etc/cron.d/sysstat
# run system activity accounting tool every 10 minutes
*/10 * * * * root /usr/lib/sa/sa1 1 1
# generate a daily summary of process accounting at 23:53
53 23 * * * root /usr/lib/sa/sa2 -A

based on the above cron entry, the sa1 command is collecting data on your server in 10 minutes interval. You can change the interval by changing the */10 to whatever value you desire, ie: */5 for every 5 minutes. The data gathered by sa1 command is stored on saxx files, stored on /var/log/sa directory on your server, with xx refering to the date of the month (ie: sa01 for data gathered on the first day of the month)

The second cron line means that on 23:53 the sa2 command will generate a daily report, stored on a plain textfile named sarxx, with xx also refering to the date of the month.

The second step is to check whether the saxx files is created by sysstat

[root@localhost sa]# ls -la /var/log/sa
total 24
drwxr-xr-x   2 root root 4096 Apr  1 18:20 .
drwxr-xr-x  12 root root 4096 Apr  1 18:10 ..
-rw-r--r--   1 root root 2064 Apr  1 18:20 sa01

Ok, so now sysstat is up and running on your server.

sysstat provides several tools to help you monitor your server, such as:

vmstat
used to monitor overall activity of the server
iostat
iostat can be used to monitor the disk activity of the server
mpstat
used to monitor processor(s) activities

Detailed functions of each tool can be found on their man pages.

I personally use sysstat for the sarxx files. It contains historical data of your server performance on a plain textfiles. You can load up the data to spreadsheet, and perform analysis to determine which part of your server is the performance bottleneck.

One tool that I often use to do this is kSar. kSar is a java application that can be used to translate your sysstat data to a graph. It’s very useful if you need to analyse the data at a glance.

kSar CPU overview

To run kSar, make sure you have java installed on your box. Then, download kSar from here, unzip, and run it by typing:

surfer@Mach5-M:~/apps/kSar-5.0.6$ java -jar kSar.jar

Then load one of a sarxx files created by sysstat (usually located on /var/log/sa for RHEL and its derivatives, /var/log/sysstat on ubuntu) by selecting Data > Load from textfile.

Memory usage on kSar

By ikhsan

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.