1. Install the System Activity Reporter package on your Linux system.
  2. Configure SAR to monitor your website or service.
  3. Use SAR to detect security breaches and performance issues.
  4. Monitor SAR’s resources usage to determine if you’re using too much CPU or memory on your system.

Steps to use System Activity Reporter

Prerequisites

  1. Linode is a cloud-based server service that provides access to a wide range of applications and services, including software updates.
  2. There are existing articles about updating packages in Linode’s documentation, so you can be sure that you’re doing everything you need to be up and running with the latest software.
  3. If you’re not sure whether your server is a production server, please check our documentation for instructions on how to update packages on Linode.

sudo apt-get install sysstat Step 2: To get a list of all the processes running on your system, we can use the sar command: sudo sar -l

Install and Configure sar

The open-source sar program is frequently used, but it’s not included in most Linux distributions. You must install it as part of the sysstat package. This section shows you how to install sar on the Debian/Ubuntu Linux distributions.

sudo apt-get install sar Step 2: Create a new sar user: useradd -m -s /bin/false sar

To enable Sar, change the value of ENABLED in the /etc/default/sysstat configuration file to true. ..

cat /etc/cron.d/sysstat

cat /etc/sysstat/sysstat.d

nano /etc/cron.d/sysstat

nano /etc/sysstat/sysstat.d

The first line of the file contains the default values for sar, while the second line sets up a custom cron job to check sysstats files for changes.

Step 5: To change the frequency setting for sar, you need to change the line.

Using sar

  1. As an interactive program:

sar -a

  1. As a shell program:

sh sar

Step 2: To use sar as an interactive program, you can use the -a option to specify the path to the sar executable. To use the sar executable in a shell program, you can use the -s option.

This command displays the current day’s saXX data to the standard output. If you omit the saXX data file, sar will default to displaying the current day’s saXX data in a text file.

  • sar -f saXX data file

sar -c sar24 | grep cpu

cpu usage: 9.5%

Final Words

System Activity Reporter is a free and open source application that can be used to monitor the activity on your computer. This information can be saved to files for later examination. The sysstat package includes this application and any related tools. The software is set to run both at 10-minute intervals and once per day at 23:59 on Debian and the majority of other distributions. Depending on your distribution, one of sar’s two default scripts, sa1 or sa2, runs instead of calling sar directly. ..