The Linux Foundation
Linux Kernel Archives
Linux Kernel Mailing List
The Linux Documentation Project
Some of the following notes come from the Linux From Scratch documentation.
Introduction to sysstatThe 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.
Installation of sysstat:Compile and install sysstat by running the following commands:
./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.
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. Here is a sample sysstat bootscript used to accomplish this:
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:
If you are using systemd, then a service file is used instead of the bootscript and symlink above. Here is a sample service file (put it in your systemd service directory):
Now the good news: The above crontab, startup script and link or systemd service file may be automatically created and installed for you when you enter "make install", providing that you have set configure'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]