Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Report generation CPU, memory, and input and output ports with the sar command     - HAProxy Windows version of the compiler and its application in the CORS (Server)

- Python uses multi-process pool (Programming)

- Analysis of memory mapping process in Linux x86-32 mode (Linux)

- Linux user login ban (Linux)

- SecureCRT in Python scripting study guide (Programming)

- C # using the HttpClient Note: Preheat the long connection (Programming)

- Depth understanding of DB2 table space (Tablespace) (Database)

- Installation Android IDE development tools, Android Studio 1.5 under Ubuntu (Linux)

- MySQL rollback insert statement causes ibd file grows double (Database)

- Linux --- manual release system cache (Linux)

- Orionode source Linux Mint installation (Linux)

- Ubuntu 14.04 Nvidia proprietary drivers for install two graphic cards (Linux)

- Oracle local user login authentication fails ORA-01031 insufficient privileges (Database)

- SUSE Linux install Oracle 10g and problem solving (Linux)

- Java development environment to build under Ubuntu (Linux)

- Use in Linux ipmitool tool (Linux)

- Nginx logging client ip (Server)

- Define and modify strings principle in Python (Programming)

- Grep how to find files based on file contents in UNIX (Linux)

- CentOS7 installation configuration Redis-3.0.0 (Database)

  Report generation CPU, memory, and input and output ports with the sar command
  Add Date : 2018-11-21      
  SAR is the first letter of the system activity reports (System Activity Report) the abbreviation. As its name suggests, as, SAR is used to collect, report and save the CPU, memory, input and output ports usage command in Unix and Linux operating systems. SAR command can dynamically generate reports, the reports can also be saved in a log file.

In this article, we will discuss the use of SAR in CentOS 7 and RHEL 7 systems in different cases. If you do not have the package installed, you can use the following single command to install it.

[Root @ localhost ~] # yum install sysstat

Start sadc (system activity data collector) Services (sysstat), this report will be written to the log file "/ var / log / sa / saDD" already exists in the document it will be archived. DD is the current date.
[Root @ localhost ~] # systemctl start sysstat
[Root @ localhost ~] # systemctl enable sysstat

It collects data every 10 minutes every day and form a report. In the figure below crontab file is responsible for the collection and report generation.

SysStat the Config file. (Sar command)

Case 1: dynamically generated five times the CPU usage every two seconds
[Root @ localhost ~] # sar 2 5
Linux 3.10.0-123.el7.x86_64 (localhost.localdomain) Monday 26 October 2015 _x86_64_ (2 CPU)

01:43:55 EDT CPU% user% nice% system% iowait% steal% idle
01:43:57 EDT all 0.00 0.00 0.25 0.00 0.00 99.75
01:43:59 EDT all 0.00 0.00 0.00 0.00 0.00 100.00
01:44:01 EDT all 0.00 0.00 0.25 0.00 0.00 99.75
01:44:03 EDT all 0.00 0.00 0.25 0.25 0.00 99.50
01:44:05 EDT all 0.00 0.00 0.00 0.00 0.00 100.00
Average: all 0.00 0.00 0.15 0.05 0.00 99.80
[Root @ localhost ~] #

If% I / Owait this one is a long value exceeds 0, then we must consider whether there are bottlenecks in terms of input-output system (such as a hard disk or network).

Case 2: Use the -o option to save the output of the sar command:
[Root @ localhost ~] # sar 2 5 -o / tmp / data> / dev / null 2> & 1
[Root @ localhost ~] #

Use "sar -f" output:
[Root @ localhost ~] # sar -f / tmp / data

Case 3: Use the -r option to generate a memory usage report

-r option in the sar command is used to generate memory usage reports.
[Root @ localhost ~] # sar -r 2 5

And data kbcommit% commit column includes the sum of memory and swap usage area.

Case 4: with -B option to generate statistical reports tab
[Root @ localhost ~] # sar -B 2 5

Report, majflts / s main display abnormal physical memory when loaded from the hard disk swap, if this value is high, then we can say that the system currently uses only memory (RAM).
% Vmeff indicates the number of pages scanned per second, if and when it is the value of 100% is normal, it is time to less than 30% can be considered to exist virtual memory problems. A value of 0 indicates that there is no time a page is scanned.

Case: 5 using the -d option to generate a block device usage reports

-d option in the sar command is used to display a status report block device. Plus behind -d -p (pretty-print) option enhances readability dev columns, as shown below:
[Root @ localhost ~] # sar -d -p 2 4

Case 6: generate network usage reports with -n

-n option in the sar command is used to generate statistical reports network usage. Here is the syntax rules:
# Sar -n {keyword} or {ALL}
[Root @ localhost ~] # sar -n ALL

Case 7: Reading sar log file with the -f

We have already discussed the sar log file is saved in the "/ var / log / sa / saDD" Lane. Use the -f option to view the log file.
[Root @ localhost ~] # sar -r -f / var / log / sa / sa26
- Ubuntu 15.10 / 14.04 install subtitling software Aegisub (Linux)
- Using 30 seconds to write a detailed analysis of garbage removal system (Linux)
- Analysis examples: Intrusion Response Linux platform Case (Linux)
- CentOS7 Kubernetes used on container management (Server)
- Ubuntu program using the Sound Recorder (Linux)
- CentOS 7.0 running Docker kernel error solution (Server)
- Linux system security configuration (Linux)
- Oracle 11g users to create, authorize and import dmp file (Database)
- Common data structures and functions of Linux process scheduling (Programming)
- To compile and install OpenCV-2.3.1 FFmpeg-2.1.2 under CentOS (Linux)
- Linux fast set ip bond (Linux)
- Mac OS X Server installation and application (Linux)
- How to disable IPv6 on Ubuntu, Linux Mint, Debian (Linux)
- Teach you how to choose to install CentOS 6.5 installation package (Linux)
- Linux /var/spool/ insufficient clientmqueue space solutions (Linux)
- Android media library of analysis: MediaProvider (Programming)
- To install Spotify in Ubuntu / Mint (Linux)
- ActiveMQ-based shared file system HA solutions (Server)
- Systemd on RHEL7 (Linux)
- RocketMQ Message Queuing simple deployment (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.