{"id":12128,"date":"2021-11-18T06:00:17","date_gmt":"2021-11-18T06:00:17","guid":{"rendered":"https:\/\/linuxways.net\/?p=12128"},"modified":"2024-03-25T02:10:31","modified_gmt":"2024-03-25T02:10:31","slug":"how-to-monitor-linux-performance-using-systat-tool","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/how-to-monitor-linux-performance-using-systat-tool\/","title":{"rendered":"How to monitor Linux performance using systat tool"},"content":{"rendered":"<p>Sysstat is a robust logging and performance monitoring utility for Linux\/Unix systems. It can be used to keep track of system performance and usage activity.<\/p>\n<p>Systat saves the statistics collected in a file that can be exported into various formats such as JSON, CSV, etc. Though many Linux distributions include GUI-based monitoring apps, sysstat is especially useful in a server setting.<\/p>\n<p>This guide will show you how to use the systat tool to collect key system information on Linux.<\/p>\n<h2>Install Systat tool<\/h2>\n<p>Systool is available in the default repositories of various Linux distros. To install on Debian-based systems , use the command:<\/p>\n<pre><strong>$ sudo apt install systool<\/strong>\r\n<\/pre>\n<p>To install on Red-Hat based distros, run the command:<\/p>\n<pre><strong>$ sudo yum install systool<\/strong><\/pre>\n<h2><a id=\"post-12128-_g71xt8d8ola5\"><\/a><strong>Common usage of Sysstat<\/strong><\/h2>\n<p>The sysstat suite comprises various tools that help collect information on CPU and I\/O statistics. This guide will discuss how to use the tools to get system information. These tools include:<\/p>\n<ul>\n<li>iostat &#8211; shows an overview of CPU and I\/O statistics for drives and partitions<\/li>\n<li>mpstat<strong>&#8211; <\/strong>displays processor statistics.<\/li>\n<li>pidstat \u2013 gives an overview of I\/O, memory statistics for processes.<\/li>\n<li>sar \u2013 used for collecting and saving all the system activities and reports.<\/li>\n<li>sadc- collects system usage activity and writes it to a file.<\/li>\n<\/ul>\n<h3><a id=\"post-12128-_cvxpio7jshpi\"><\/a><strong>Check CPU usage<\/strong><\/h3>\n<p>Sars is used to collect system statistics such as CPU utilization, memory among others. View your CPU utilization statistics for the day as shown. Sar monitors data every 10 minutes by default.<\/p>\n<pre><strong>$ sar -u<\/strong>\r\n<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"893\" height=\"240\" class=\"wp-image-12129\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-306.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-306.png 893w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-306-300x81.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-306-768x206.png 768w\" sizes=\"auto, (max-width: 893px) 100vw, 893px\" \/><\/strong><\/p>\n<p>To display real-time CPU utilization for a set period of time, specify the intervals in seconds followed by the number of entries to report. For instance, to view total CPU utilization every 3 seconds for a total of 15 times run:<\/p>\n<pre><strong>$ sar -u 3 15<\/strong>\r\n<\/pre>\n<h3>Check individual CPU usage<\/h3>\n<p>Currently, the majority of PCs have several cores. To display the statistics of each core use the sars command followed by the &#8220;-P ALL&#8221; parameter as shown below:<\/p>\n<pre><strong>$ sar -P ALL 1 1<\/strong>\r\n<\/pre>\n<p>The screen below shows the system&#8217;s four cores with the same time interval and output parameters applied.<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"908\" height=\"347\" class=\"wp-image-12130\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-307.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-307.png 908w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-307-300x115.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-307-768x293.png 768w\" sizes=\"auto, (max-width: 908px) 100vw, 908px\" \/><\/strong><\/p>\n<h3>Check memory usage<\/h3>\n<p>To display the amount of memory in use at a particular time use the -r option.<\/p>\n<pre><strong>$ sar -r<\/strong>\r\n<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"1171\" height=\"262\" class=\"wp-image-12131\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-308.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-308.png 1171w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-308-300x67.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-308-1024x229.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-308-768x172.png 768w\" sizes=\"auto, (max-width: 1171px) 100vw, 1171px\" \/><\/strong><\/p>\n<h3>Display device report<\/h3>\n<p>Use the iostat command to display a device report showing current data transfer per second (tps), average block rate, and data read and write statistics. Run the following command:<\/p>\n<pre><strong>$ iostat -d<\/strong>\r\n<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"1047\" height=\"512\" class=\"wp-image-12132\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-309.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-309.png 1047w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-309-300x147.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-309-1024x501.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-309-768x376.png 768w\" sizes=\"auto, (max-width: 1047px) 100vw, 1047px\" \/><\/strong><\/p>\n<p>The columns in the output above represent:<\/p>\n<ul>\n<li>tps &#8211; transfers per second issued on the device<\/li>\n<li>kB_read\/s &#8211; shows the amount of kilobytes read in blocks per second<\/li>\n<li>kB_wrtn\/s &#8211; the amount of data written to devices in kbs per second<\/li>\n<li>kB_read &#8211; total kilobytes read<\/li>\n<li>kB_wrtn &#8211; total number of kilobytes written<\/li>\n<\/ul>\n<p>To view extended I\/O statistics run:<\/p>\n<pre><strong>$ iostat -x<\/strong>\r\n<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"1747\" height=\"531\" class=\"wp-image-12134\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-310.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-310.png 1747w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-310-300x91.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-310-1024x311.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-310-768x233.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-310-1536x467.png 1536w\" sizes=\"auto, (max-width: 1747px) 100vw, 1747px\" \/><\/strong><\/p>\n<h3>View current processes<\/h3>\n<p>The pidstat command is used to keep track of each individual task managed by the kernel. To get information about the running processes, run the<strong> pidstat <\/strong>command followed by -d parameter as shown.<\/p>\n<pre><strong>$ pidstat -d<\/strong>\r\n<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"1012\" height=\"823\" class=\"wp-image-12135\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-311.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-311.png 1012w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-311-300x244.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-311-768x625.png 768w\" sizes=\"auto, (max-width: 1012px) 100vw, 1012px\" \/><\/strong><\/p>\n<p>You can also pidstat with the -r option to analyze memory usage with particular processes:<\/p>\n<pre><strong>$ pidstat -r<\/strong>\r\n<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"1138\" height=\"889\" class=\"wp-image-12137\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-312.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-312.png 1138w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-312-300x234.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-312-1024x800.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-312-768x600.png 768w\" sizes=\"auto, (max-width: 1138px) 100vw, 1138px\" \/><\/strong><\/p>\n<h2>Conclusion<\/h2>\n<p>Sysstat is a powerful monitoring tool for Linux environments. For further information on Systat, check out the <a href=\"http:\/\/sebastien.godard.pagesperso-orange.fr\/documentation.html\">Sysstat Documentation<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Sysstat is a robust logging and performance monitoring utility for Linux\/Unix systems. It can be used to keep track of system performance and usage activity. Systat saves the&hellip;<\/p>","protected":false},"author":110,"featured_media":12133,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,83,168,2],"tags":[],"class_list":["post-12128","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-opensuse","category-scripting","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/12128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=12128"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/12128\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/12133"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=12128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=12128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=12128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}