bandeau1bandeau2

Useful links:
Freecode
IceWalkers

The Linux Foundation
Linux Kernel Archives
Linux Kernel Mailing List
The Linux Documentation Project

 
 
Valid HTML 4.01 Transitional
 


Documentation


 Some of the following notes come from the Linux From Scratch documentation.

 Introduction to sysstat

The sysstat package contains utilities to monitor system performance and usage activity. Sysstat contains various utilities, common to many commercial Unixes, and tools you can schedule via cron to collect and historize performance and activity data.
  • iostat(1) reports CPU statistics and input/output statistics for devices, partitions and network filesystems.
  • mpstat(1) reports individual or combined processor related statistics.
  • pidstat(1) reports statistics for Linux tasks (processes) : I/O, CPU, memory, etc.
  • sar(1) collects, reports and saves system activity information (CPU, memory, disks, interrupts, network interfaces, TTY, kernel tables,etc.)
  • sadc(8) is the system activity data collector, used as a backend for sar.
  • sa1(8) 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(8) writes a summarized daily activity report. It is a front end to sar designed to be run from cron.
  • sadf(1) 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.
  • nfsiostat(1) reports input/output statistics for network filesystems (NFS).
  • cifsiostat(1) reports CIFS statistics.
Go to the Features page to display a list of sysstat's main features.

Installation of sysstat:

Compile and install sysstat by running the following commands:

./configure
$ make
$ su
<enter root password>
#
make install
Note: With older versions of sysstat that don't support autoconf (up to v7.0.4), configuring sysstat was done with "make config" instead of "./configure".

Command explanations:
./configure: Runs the auto-configuration process. This script attempts to guess correct values for various system-dependent variables used during compilation.  It uses those values to create a "Makefile" in the current directory.
You can give "configure" values for configuration parameters. For example, you can set the installation directory with the "--prefix" parameter. The following example shows how to set the installation directory to /usr (instead of the default value /usr/local):

$ ./configure --prefix=/usr

Enter "./configure --help" to display all the available parameters.
Note: Instead of running "./configure", you can run "iconfig", the Interactive Configuration script. This is a front-end to "configure". It will prompt you for various parameters values used by "configure".

make: Compiles sysstat from sources. The various commands are then available.
make install: Installs sysstat binaries, and even create a crontab to start collecting data automatically if requested to do so at config stage.

Configuring sysstat:

Cron information:
To begin gathering sysstat history information, you must add to, or create a privileged user's crontab. The default history data location is /var/log/sa. The user running sysstat utilities via cron must have write access to this location. 
Below is an example of what to install in the crontab "sysstat" located in /etc/cron.d directory and using Vixie cron syntax. Adjust the parameters to suit your needs. Use man sa1 and man sa2 for information about the commands.

# Run system activity accounting tool every 10 minutes
*/10 * * * * root /usr/lib/sa/sa1 1 1
# 0 * * * * root /usr/lib/sa/sa1 600 6 &
# Generate a daily summary of process accounting at 23:53
53 23 * * * root /usr/lib/sa/sa2 -A


Each day a file will be created in the /var/log/sa directory.

Startup script information:

At system startup, a LINUX RESTART message must be inserted in the daily data file to tell sar that the kernel counters have been reinitialized. Create a sysstat bootscript to accomplish this using the following commands:

$ cat > /etc/rc.d/init.d/sysstat << "EOF"
#!/bin/sh
# Begin $rc_base/init.d/sysstat

# Based on sysklogd script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org

. /etc/sysconfig/rc
. $rc_functions

case "$1" in
        start)
                echo "Calling the system activity data collector (sadc)..."
                /usr/lib/sa/sadc -F -L -
                evaluate_retval
                ;;
        *)
   
                echo "Usage: $0 start"
               exit 1
                ;;
esac

# End $rc_base/init.d/sysstat
EOF
$
chmod 754 /etc/rc.d/init.d/sysstat

The sysstat bootscript only needs to run at system startup, therefore only one symlink is required. Create this symlink in /etc/rc.d/rcsysinit.d using the following command:

# ln -sf ../init.d/sysstat /etc/rc.d/rcsysinit.d/S85sysstat

Important note: The above crontab, startup script and link may be automatically created and installed for you when you enter "make install", providing that you have set autoconf's  option "--enable-install-cron" during configuration stage:

$ ./configure
--enable-install-cron

If you prefer using the Interactive Configuration script (iconfig), answer 'y' (for "yes") at the question:
Set crontab to start sar automatically? (y/n) [--enable-install-cron]