Skip to content

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.

Step 1.  Install sysstat
sudo apt-get install sysstat

Step 2. Enable stat collection
sudo vi /etc/default/sysstat
change ENABLED=”false” to ENABLED=”true”
save the file

Step 3. Change the collection interval from every 10 minutes to every 2 minutes.
sudo vi /etc/cron.d/sysstat
5-55/10 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1
*/2 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1
save the file

Step 4. Restart sysstat
sudo service sysstat restart

Step 5. If you want to see all statistics you can type:
sar -A

Step 6. 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)


man sysstat
man sar

Posted in Knowledge Base.

Tagged with , , .

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

or, reply to this post via trackback.