System Static is a collection of performance monitoring tools for Linux that could debug performance issues on your Linux system. SysStat is open-source, free, and powerful and is available on Unix and Unix-like operating systems. Using SysStat allows you to view the system performance data in real-time or analyze data from the saved archives. We are going to present you with Tutorial Install SysStat On Ubuntu 20.04 LTS. Do not miss the hot 2021 offers of Eldernode to purchase the best suitable packages. Buy your own Linux VPS and stay with us!
Table of Contents
How To Install SysStat On Ubuntu 20.04 LTS
To let this tutorial work better, please consider the below Prerequisites:
A non-root user with sudo privileges.
To set up, follow our Initial server setup on Ubuntu 20.04.
Let’s go through the steps of this guide to learn the installation and configuration of SysStat on your Ubuntu system.
SysStat Utilities
SysStat is written in C and provides a number of utilities such as sar, tapestat, cifsiostat, pidstat, mpstat, and iostat. Every utility runs a task to collect the system use activities and system performance.
Install and Configure SysStat on Ubuntu 20.04 | Ubuntu 18.04
Step 1:
To start installing SysStat, you need to know that its package is available in the default package repositories. So, you can install by commands. Since the default repositories have older-version of packages, you need to use installation with the source.
Run the following command if you want to use the package manager:
sudo apt install sysstat -y
Step 2:
Since the SysStat monitoring is disabled by default, you should edit the configuration file in a text editor to enable the SysStat monitoring. So, Let’s enable the SysStat monitoring and edit the following file and save it.
sudo vim /etc/default/sysstat
Then, you must set ENABLED to true as below:
ENABLED="true"
Now you can save and close the file.
Enable the SysStat service and start it by running the command below when you enabled the monitoring.
sudo systemctl enable sysstat
sudo systemctl start sysstat
Step 3:
In this step, you will learn about real-time monitoring with SysStst. sar command-line tool could help you to get real-time system static. There is various static on the command-line, let’s see some of them.
Current CPU Usage _ Use -u with the star command to view real-time CPU static.
sar -u
You can view the real-time CPU uses if you specify the real-time interval and number of times to show data. Let’s see an example: to view real-time CPU uses for 5 times with the difference of 1 second.
sar -u 1 5
Since most of the CPUs are multi-core, you can view the CPU utilization data in more depth. Use -P ALL command to view utilization details of each core individually.
sar -P ALL 1 3
View Device Usage _ Use the iostat command to find disk statics.
iostat shows the current data transfer per second, the total number of blocks read and write to disk, and an average block per second.
iostat -d 1 5
Look at the details:
tps _ Transfer per second
Blk_read/s _ Total amount of data read in blocks per second.
Blk_wrtn/s _ Total amount of data written in blocks per second.
Blk_read _ Total block read.
Blk_wrtn _ Total block written.
Use the following command to view more extended I/O statics of the disk.
iostat -x 1 5
View Running Process Resource Utilization _ Using pidstat command with switch -d provides you details of currently running processes on systems.
pidstat -d
If you try pidstat with -r to show resource utilization by processes on every 1 second for the 5 times.
pidstat -r 1 5
Memory Utilization Data _ Use sar command with -r to view the current Memory utilization details for the 5 times on every 1 second.
sar -r 1 5
Step 4:
SysStat stores monitoring data in files. To see how to view historical data with SysStat continue on this step. You can do this with the star command. It keeps 7 days of data by default but it is possible to change the number of days in /etc/sysstat/sysstat file.
HISTORY=28
You can find all the log files under /var/log/sysstat directory that is stored there. The filenames will be as sa1, sa2, and so on. (1 and 2 is the data of the current month)
To view memory utilization report of data 20th of the current month, type:
sar -r -f /var/log/sysstat/sa20
The range time is able to be specified with the above command. It can view static between given time only. To view static between 10:00PM and 11:00 PM, type:
sar -r -f /var/log/sysstat/sa20 -s 22:00:00 -e 23:00:00
sar -u -f /var/log/sysstat/sa28