LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   A question about SAR (System Activity Report) command (https://www.linuxquestions.org/questions/linux-software-2/a-question-about-sar-system-activity-report-command-4175734087/)

Jason.nix 02-21-2024 05:52 AM

A question about SAR (System Activity Report) command
 
Hello,
I use Debian and installed sysstat, then I activated and executed SAR using the following commands:
Code:

# systemctl enable sysstat
#
# systemctl start sysstat

This program created the file /var/log/sysstat/sa21. I want to know if SAR is automatically recording system activities or need to write cron file?

Thank you.

jayjwa 02-21-2024 11:55 AM

I'm not on Debian and we don't have systemd, but here I have to start the collector and tell it when to run via a startup script. Fcron runs reports at various times. The script that comes with it leaves much to be desired so I wrote a different one.

Here's systab's fcron tab snippet for sar:
Code:

# Enter a "Restart" mark in the logfile for sadc and make sure that
# logfile is created just after midnight each day so that the 'sar'
# command with always produce output instead of 'file not found'
& 1 0 * * * /usr/lib64/sa/sadc -

# Generate a summary of process accounting each midnight
# This is only the report generation, and is still needed.
%nightly * 23 /usr/lib64/sa/sa2 -A

The part of the script that runs sadc:
Code:

/usr/lib64/sa/sadc -
/usr/lib64/sa/sadc -F -S XALL -L ${sample_rate} - &

where sample_rate is settable. Currently I have it at 900.

Jason.nix 02-21-2024 12:47 PM

Quote:

Originally Posted by jayjwa (Post 6485040)
I'm not on Debian and we don't have systemd, but here I have to start the collector and tell it when to run via a startup script. Fcron runs reports at various times. The script that comes with it leaves much to be desired so I wrote a different one.

Here's systab's fcron tab snippet for sar:
Code:

# Enter a "Restart" mark in the logfile for sadc and make sure that
# logfile is created just after midnight each day so that the 'sar'
# command with always produce output instead of 'file not found'
& 1 0 * * * /usr/lib64/sa/sadc -

# Generate a summary of process accounting each midnight
# This is only the report generation, and is still needed.
%nightly * 23 /usr/lib64/sa/sa2 -A

The part of the script that runs sadc:
Code:

/usr/lib64/sa/sadc -
/usr/lib64/sa/sadc -F -S XALL -L ${sample_rate} - &

where sample_rate is settable. Currently I have it at 900.

Hello,
Thank you so much for your reply.
Do you think it is necessary to write a cron file on Debian?

jayjwa 02-23-2024 08:35 AM

If you don't care about the report file, then I'd say you don't need it. See the 'sa2' man page about that.

eklavya 02-28-2024 09:00 PM

It records automatically. Just make sure Enabled is True in the file /etc/default/sysstat
Restart sysstat after updating it.
sudo systemctl restart sysstat

Historical files are found in /var/log/systat, filename with day.

You can check the statistics of that day.

Jason.nix 03-02-2024 12:42 AM

Quote:

Originally Posted by eklavya (Post 6486535)
It records automatically. Just make sure Enabled is True in the file /etc/default/sysstat
Restart sysstat after updating it.
sudo systemctl restart sysstat

Historical files are found in /var/log/systat, filename with day.

You can check the statistics of that day.

Hello,
Thank you so much for you reply.
I have some questions:

1- In the /etc/default/sysstat file, the value was ENABLED="false", but the report was generated for each day. Why?

2- There are two types of files in the /var/log/systat directory, some starting with sa and some starting with sar. What is their difference?
Code:

sa01  sa23  sa25  sa27  sa29  sar22  sar24  sar26  sar28 
sa02  sa24  sa26  sa28  sar01  sar23  sar25  sar27  sar29

3- What is the usage of sysstat-collect service?


All times are GMT -5. The time now is 06:30 AM.