Sysstat Utilities

The sysstat package provides a number of utilities for collecting the system use activities and system performance.

iostat – Used for CPU statistics and input/output statistics for the block devices and partitions and generate report. mpstat – Used for processor related statistics and reports. pidstat – Used for I/O, CPU, memory statistics for Linux processes and generate report. tapestat – Used for the statistics for tape drives attached to Linux system. cifsiostat – Used for generating reports CIFS statistics. sar – Used for collects and saves all the system activities and report.

Step 1 – Install Sysstat on Ubuntu

Sysstat package is available in default package repositories, You can install using the following commands. But the default repositories have older version of packages. So we recommend to use installation with source in next step. If you still want to use package manager just run below commands.

Step 2 – Configure Sysstat

By default Sysstat monitoring is disabled. To enable the sysstat monitoring, edit the configuration file in text editor: You need to Let’s enable the sysstat monitoring. Edit the following file and save it. Set ENABLED to true as below:

Save file and close it. After enabling the monitoring, enable the sysstat service and start it by executing:

Step 3 – Realtime Monitoring with Sysstat

You can get real time system static with sar command line tool. Below is some about various static to view on command line.

Current CPU Usage – Use -u with the sar command to view realtime cpu staticssar -u You can also view the real-time CPU uses by specifying the time interval and number of times to show data. For example, to view real-time CPU uses for 5 times with the difference of 1 second.sar -u 1 5 You can view the CPU utilization data in more depth. Nowadays most of the CPU’s are multi-core. To view utilization details of each core individually use -P ALL command.sar -P ALL 1 3 View Device Usage – Use the iostat command to find disk statics. It shows the current data transfer per second, the total number of blocks read and write to disk and an average block per seconds.iostat -d 1 5 Details: tps – Transfers 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 blocks read. Blk_wrtn – Total blocks written. You can view more extended I/O statics of disk using the following command.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 Also 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 – View Historical Data with Sysstat

Sysstat also store monitoring data in files. You can also see the historical data with the sar command. By default it keeps 7 days of data bu you can change the number of days in /etc/sysstat/sysstat file. You can view the CPU utilization data in more depth. Nowadays most of the CPU’s are multi-core. To view utilization details of each core individually use -P ALL command.

tps – Transfers 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 blocks read. Blk_wrtn – Total blocks written.

You can view more extended I/O statics of disk using the following command.

All the log files are stored under /var/log/sysstat directory. The filenames will be as sa1, sa2 and so on, here 1 and 2 is the date of current month. For example to view memory utilization report of date 15’th of current month, type: Here we provide the file of reqired date with -f option to view historic sar data.

You can also specified time range with the above command to view static between given time only. To view static between 7:00AM and 8:00AM, type: Similarly, you can use following command to view CPU utilization data of any date with sar command.

Conclusion

In this tutorial, you have learned to install and configure sysstat performance monitoring utility on your Ubuntu 20.04 system.

How to Install and Configure Sysstat on Ubuntu 20 04   TecAdmin - 73