Translation(s): English - EspaƱol ~

(!) Discussion


About

sysstat contains the following system performance tools:

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.

Installation

apt-get install sysstat

Sar

Sar is set of tools that helps you to collect and report the system activity.

You can schedule via cron or systemd to collect and historize performance and activity data on Debian. Default sampling interval is 10 minutes but this can be changed of course (it can be as small as 1 second).

Enable Sar

Technically is sar the program that collect the information but packagers decided to handle this through sysstat name.

Once you install sysstat package edit the file /etc/default/sysstat and change the string ENABLED="false" to ENABLED="true".

After execute the following commands:

systemctl start sysstat
systemctl enable sysstat

You can check if sysstat or sar is running with the following command:

systemctl status sysstat

You can check if sar is storing the performance information on the following directory /var/log/sysstat, you will get a file with the format sa followed by a number that represents day of the month. for sample sa31.

Once the day is finished a process will convert that binary file to a text file that contains the information in a human readable form wit the name sar followed by a number that represents day of the month... for example sar30.

Tune Sar

Sar is configured by default to take the information every 10 minutes, that can be useful or not. I depends of the space on disk, granurality of the information that you want, resource overhead.

You can check the frequency of the samples with the following command:

sar -q

Observe the first column, you will notice the sample interval.

To change the frequency on Debian 11 use the following command:

vim /etc/systemd/system/sysstat.service.wants/sysstat-collect.timer

Change the line:

[Timer]
OnCalendar=*:00/10

To:

[Timer]
OnCalendar=*:00/1

Reload systemctl daemon:

systemctl daemon-reload

Restart sysstat service:

systemctl restart sysstat

References