Monitoring your system with sysstat

Sysstat is a package of monitoring tools, these are the tools included in the package.

iostat
Reports CPU statistics and input/output statistics for devices, partitions and network filesystems.
mpstat
Reports individual or combined processor related statistics.
pidstat
Reports statistics for Linux tasks (processes) : I/O, CPU, memory, etc.
sar
Collects, reports and saves system activity information (CPU, memory, disks, interrupts, network interfaces, TTY, kernel tables,etc.)
sadc
Is the system activity data collector, used as a backend for sar.
sa1
Collects and stores binary data in the system activity daily data file. It is a front end to sadc designed to be run from cron.
sa2
Writes a summarized daily activity report. It is a front end to sar designed to be run from cron.
sadf
Displays data collected by sar in multiple formats (CSV, XML, etc.) This is useful to load performance data into a database, or import them in a spreadsheet to make graphs.

To use this tools, you need to install sysstat

-First download it from http://freshmeat.net/projects/sysstat/ and perform the usual installation procedures.

One great feature of this tools is that you can configure it to run as a daemon, and it will log a lot of info about your system.

To start it if you are using Debian, edit with your favorite text editor, in my case is vi

vim /etc/default/sysstat

And change the line: ENABLED=”false” to ENABLED=”true”, so that file may look like this

#
# Default settings for /etc/init.d/sysstat, /etc/cron.d/sysstat
# and /etc/cron.daily/sysstat files
#

# 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”

# Additional options passed to sa1 by /etc/init.d/sysstat
# and /etc/cron.d/sysstat
# By default contains the `-d’ option responsible for
# generating disk statisitcs.
SA1_OPTIONS=”-d”

# Additional options passed to sa2 by /etc/cron.daily/sysstat.
SA2_OPTIONS=””

sa1 is a variant of sadc, which is designed to work as a cronjob, just like sa2 which is a variant of sar command also designed to be run as cronjob.

If you are not using Debian, you will not have the /etc/default/sysstat, so you will have to add to your root’s cronjob file this lines:

0 8-18 * * 1-5 /usr/lib/sysstat/sa1 1200 3 &
5 19 * * 1-5 /usr/lib/sysstat/sa2 -A &

The -d option in sa1 makes it to store disks data, which by default are not written.

Now you can use sar to see the data stored, in your system, check the page of the project for more information about this performance toolkit

Source http://www.go2linux.org

  1. Leave a comment

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: