LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-21-2024, 05:52 AM   #1
Jason.nix
Member
 
Registered: Feb 2023
Posts: 565

Rep: Reputation: 10
Post 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.

Last edited by Jason.nix; 02-21-2024 at 05:54 AM.
 
Old 02-21-2024, 11:55 AM   #2
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 787

Rep: Reputation: 250Reputation: 250Reputation: 250
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.
 
Old 02-21-2024, 12:47 PM   #3
Jason.nix
Member
 
Registered: Feb 2023
Posts: 565

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by jayjwa View Post
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?
 
Old 02-23-2024, 08:35 AM   #4
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 787

Rep: Reputation: 250Reputation: 250Reputation: 250
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.
 
Old 02-28-2024, 09:00 PM   #5
eklavya
Member
 
Registered: Mar 2013
Posts: 636

Rep: Reputation: 142Reputation: 142
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.
 
1 members found this post helpful.
Old 03-02-2024, 12:42 AM   #6
Jason.nix
Member
 
Registered: Feb 2023
Posts: 565

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by eklavya View Post
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?

Last edited by Jason.nix; 03-02-2024 at 12:52 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to Use Sar (System Activity Reporter) LXer Syndicated Linux News 0 08-14-2022 05:03 PM
LXer: Monitoring Linux system resources using SAR (System Activity Report) LXer Syndicated Linux News 0 12-24-2020 12:27 PM
LXer: SAR – Linux System Performance Monitoring Tool (Check Linux System Activity Report Using the SAR Command) LXer Syndicated Linux News 0 09-16-2019 05:00 PM
LXer: SAR – Linux System Performance Monitoring (Check Server Activity Logs Using SAR Command) LXer Syndicated Linux News 0 01-23-2017 04:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration