Author: Sahil Suri

Linux SAR command: Report historical data – Part 3

SAR file collection and historical reporting data: In a previous article, we described how sar reports data on various system performance metrics in real time. In this article, we talk about sar data is collected, stored and retrieved. When we install sysstat, it adds the following additional utilities which are responsible for collecting and storing sar data: sadc: This tool collects sar data to make it available for retrieval at a later date. sa1: It saves system activities in a binary data file. sa1 depends on sadc to provide the data. sa2: It creates a daily summary of the collected statistics. sadf: Allows generation of sar report in CSV, XML, and other formats. Both sa1 and sa2 utilities run as cron jobs. The default sysstat cron file is /etc/cron.d/sysstat and is as follows: sudo cat /etc/cron.d/sysstat # Run system activity accounting tool every 10 minutes */10 * * * * root /usr/lib64/sa/sa1 1 1 # Generate a daily summary of process accounting at 23:53 53 23 * * * root /usr/lib64/sa/sa2 -A The file is root readable and thus requires superuser privileges to access. ls -l /etc/cron.d/sysstat -rw------- 1 root root 235 Mar  8  2016 /etc/cron.d/sysstat Let’s understand the two cron jobs mentioned above: The first sysstat cron job: /usr/local/lib/sa/sa1 It runs every 10 min and collects sar data for historical reference. This writes the data to /var/log/sa/saXX file....

Read More

SAR command: Monitor CPU, Memory, disk and IO in Linux – Part 2

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: [sahil@linuxnix.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

SAR command for Performance monitoring in Linux – Part 1

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

Over 16,000 readers, Get fresh content from “The Linux juggernaut”

Email Subscribe

ABOUT ME..!

My photo
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.

banner