Tool sysstat

=How to configure sysstat/sar on Ubuntu/Debian=

This article describes how to install and use sysstat (sar) a system performance tools for Linux. According to the package description it includes the following system performance tools:

- sar: collects and reports system activity information.

- iostat: reports CPU utilization and disk I/O statistics.

- mpstat: reports global and per-processor statistics.

- pidstat: reports statistics for Linux tasks (processes).

- sadf: displays data collected by sar in various formats.

The statistics reported by sar deal with I/O transfer rates, paging activity, process-related activities, interrupts, network activity, memory and swap space utilization, CPU utilization, kernel activities and TTY statistics, among others.

Both UP and SMP machines are fully supported.

Install sysstat
sudo apt-get install sysstat

Enable stat collection
sudo vi /etc/default/sysstat

Change ENABLED=”false” to ENABLED=”true”

Save the file

Change the collection interval
sudo vi /etc/cron.d/sysstat

Change from every 10 minutes to every 2 minutes, for example:

This is every 10 minutes 5-55/10 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1 Change to every 2 minutes */2 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1

Save the file

Restart sysstat
sudo service sysstat restart

View Statistics
If you want to see all statistics you can type: sar -A

If you want to save the statistics for further analysis to a file use: sudo sar -A > $(date +`hostname`-%d-%m-%y-%H%M.log)