Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Monitoring Tools»How to Install and Configure Sysstat on Ubuntu 20.04

    How to Install and Configure Sysstat on Ubuntu 20.04

    RahulBy RahulJuly 28, 20204 Mins ReadUpdated:July 28, 2020

    Sysstat is a powerful system performance monitoring tool written in C language. This is the best tool I found for the debugging of performance issues on my Linux systems. You can view the system performance data in real time or analyze data from the saved archives. Sysstat is an opensource and freely available tool. This tutorial will help you to install Sysstat package on your system and monitor Linux system performance.

    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.

    sudo apt install sysstat -y
    

    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.

    sudo vim /etc/default/sysstat
    

    Set ENABLED to true as below:

    1
      ENABLED="true"

    Save file and close it.

    After enabling the monitoring, enable the sysstat service and start it by executing:

    sudo systemctl enable sysstat
    sudo systemctl start sysstat
    

    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 statics
      sar -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.

    1
    HISTORY=28

    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:

    sar -r -f /var/log/sysstat/sa15
    

    Here we provide the file of reqired date with -f option to view historic sar data.

    View historic data with sar command

    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:

    sar -r  -f /var/log/sysstat/sa15 -s 07:00:00 -e 08:00:00
    

    Similarly, you can use following command to view CPU utilization data of any date with sar command.

    sar -u  -f /var/log/sysstat/sa28
    

    Conclusion

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

    monitoring sar sysstat
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Install Ruby on Ubuntu 20.04
    Next Article How to Create and Access phpinfo() File

    Related Posts

    How to Install Nagios Client (NRPE) on Ubuntu 20.04

    3 Mins Read

    How to Install Nagios Server on Ubuntu 20.04

    Updated:June 3, 20213 Mins Read

    How to Install Netdata Monitoring Tool on Ubuntu 20.04

    2 Mins Read

    How To Install Zabbix Server 5.0 on Ubuntu 20.04

    Updated:August 11, 20205 Mins Read

    How To Install Zabbix Agent on Ubuntu 20.04

    Updated:July 12, 20202 Mins Read

    How To Install Zabbix Server on CentOS/RHEL 8

    Updated:February 14, 20206 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • What is CPU? – Definition, Types and Parts
    • What is the /etc/aliases file
    • What is the /etc/nsswitch.conf file in Linux
    • How to Install Ionic Framework on Ubuntu 22.04
    • What is the /etc/hosts file in Linux
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.