Measuring CPU performance with SAR command: We will continue our journey with our SAR command. We already covered on SAR command in our first post on how to install it. In this post we will see how to use SAR command to monitor CPU, RAM(Memory), disk and IO stats. Example3: To report on CPU performance in sar command, we use the -u flag. Here is an example: [email@example.com:~] $ sar -u 1 2 Linux 2.6.32-642.13.1.el6.x86_64 (linuxnix.com) 10/12/2017 _x86_64_ (2 CPU) 09:13:11 AM CPU %user %nice %system %iowait %steal %idle 09:13:12 AM all 0.00 0.00 1.01 0.00 0.00 98.99 09:13:13 AM all 0.50 0.00 0.50 0.00 0.00 98.99 Average: all 0.25 0.00 0.75 0.00 0.00 98.99 Here we can see that sar is reporting CPU utilization twice at an interval of one second and we have an average line in the end. The time is as per the systems’ time zone and displays it in real time, i.e., SAR begins reporting at 09:13:11 AM and ends at 09:13:13 AM which was the actual time on the server when the command finished. Exploring the meaning of each SAR field reported %user: Percentage of CPU utilization that occurred while executing at the user level which includes application processes, user running jobs, etc. %nice: Percentage of CPU utilization that occurred while executing at the user level with nice priority. I won’t go into...Read More
Author: Sahil Suri
SAR command introduction in Linux SAR often used as an acronym for system activity reporter, is a versatile performance monitoring tool that forms an integral part of any system administrators’ toolkit. In Linux, the sar utility is installed as a part of the sysstat package. We may verify this by listing the files installed as a part of the sysstat rpm and search for sar as shown below: [sahil@linuxnix:~] $ rpm -qa | grep sysstat sysstat-9.0.4-31.el6.x86_64 [sahil@linuxnix:~] $ rpm -ql sysstat | grep sar /usr/bin/sar /usr/share/man/man1/sar.1.gz The sysstat package is installed by default on a newly built system but can be installed manually as well with the following command. Install sysstat in Redhat/Fedora/CentOS Linux We use yum command to install sysstat in Linux. [root@linuxnix /]# yum install sysstat Loaded plugins: fastestmirror, ovl base | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 ---> Package sysstat.x86_64 0:10.1.5-12.el7 will be installed Installing: sysstat x86_64 10.1.5-12.el7 base 310 k Installed: sysstat.x86_64 0:10.1.5-12.el7 Dependency Installed: cronie.x86_64 0:1.4.11-17.el7 cronie-anacron.x86_64 0:1.4.11-17.el7 crontabs.noarch 0:1.11-6.20121102git.el7 lm_sensors-libs.x86_64 0:3.4.0-4.20160601gitf9185e5.el7 systemd-sysv.x86_64 0:219-42.el7_4.1 Updated: dracut.x86_64 0:033-502.el7 Dependency Updated: systemd.x86_64 0:219-42.el7_4.1 systemd-libs.x86_64 0:219-42.el7_4.1 Complete! Install sysstat package in Debian/Ubuntu Linux root@linuxnix:/# apt-get install sysstat Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: libsensors4 Suggested packages: lm-sensors isag The following NEW packages will be installed: libsensors4 sysstat 0...Read More
Take this course
My name is Surendra Kumar Anne. I hail from Vijayawada which is cultural capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. At present I work at Bank of America as Sr. Analyst Systems and Administration. You can contact me at surendra (@) linuxnix dot com.