Lab Environment:
CentOS Release 6.6 (Final) One
IP Address: 172.16.249.230
glances is a Linux, BSD Open Source command line system monitoring tool, which is developed using the Python language to monitor CPU, load, memory, disk I/O, network traffic, file system, system temperature and other information. This article describes the usage and techniques of glances to help Linux system administrators understand server performance.
a . Glances Introduction
glances can be for Unix and the Linux performance experts provide capabilities to monitor and analyze performance data, including:
CPU Usage Rate
Memory usage
Kernel statistics and running queue information
Disk I/O speed, transmission, and reading / Write Rate
Free space in the file system
Disk Adapter
Network I/O speed, transmission, and reading / Write Rate
Page space and page speed
The process that consumes the most resources
Computer Information and system resources
glances The tool can display important system information in real time on the user's terminal and update it dynamically. This efficient tool can work on any terminal screen. In addition, it does not consume a lot of CPU resources, usually less than 2%. The glances displays the data on the screen and updates it every two seconds. You can also change this time interval to a value that is longer or shorter. the glances tool can also capture the same data to a file for later analysis and drawing of the report. The output file can be in the form of a spreadsheet (. csv) or HTML format.
two . Glances installation
two methods of installation glances
there are usually two ways of installing glances .
The first is to compile the source code in such a way that this method is more complex and may encounter a package dependency problem.
the second is to use a specific package management tool to install glances , this method is relatively simple.
This article uses the latter, which should be explained in CentOS a specific package management tool to install. glances to configure EPEL repofirst, and then install glances.
if you want to obtain bothRHELof high-quality, high- performance, highly reliable, and the need for easy-to-use (key is free) package update function, thenFedora ProjectLaunch ofEPEL(Extra Packages for Enterprise Linux,Http://fedoraproject.org/wiki/EPEL) Just right for you. It is made up ofFedoracommunity-Built toRHELand derivative distributions such asCentOS,Scientific Linuxand other projects that provide high-quality software packages. Put it on.EPEL, just like inFedoraon the same page, you canYum Install Package-name, install the software as you choose. Installation UseEPELvery simple:
First find the image source site closest to you:
http://mirrors.fedoraproject.org/publiclist/EPEL/6/x86_64/
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/54/05/wKioL1R1vyDR9VUVAAJrkesPqK4032.jpg "title=" 1.png " alt= "Wkiol1r1vydr9vuvaajrkespqk4032.jpg"/>
Choose the one in Beijing Oh!
#wgethttp://mirrors.yun-idc.com/epel/rpm-gpg-key-epel-6 #rpm--importrpm-gpg-key-epel-6 #rm-frpm-gpg-key-epel-6 # Vi/etc/yum.repos.d/epel.repo [Epel] Name=epel rpmrepository for Red Hat Enterprise Linux baseurl=http:// mirrors.yun-idc.com/epel/6/$basearch/gpgcheck=1 enabled=0
three . Glances How to use
glances is a command-line tool that includes the following command options:
-B: Show network connection speed byte/S-B @IP |host: Bind server-side IP address or host name-C @IP |host: Connect glances Server-C file: Set profile default is/etc/glances/glances.con F-d: Turn off disk I/O module-e: Display sensor temperature-F file: Set output file (format is HTML or CSV)-m: Close mounted Disk module-N: Shut down network module-P Port: Set the Run port by default is 61209-p password: Client/server password-S: Set glances run mode to server-T sec: Set screen refresh interval in seconds, default value of 2 seconds, value License range: 1~32767-h: Display Help Information-V: Display version information
glances working interface such as:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/05/wKioL1R1v1nQddA4AASAcnx6v2E580.jpg "title=" 2.jpg " alt= "Wkiol1r1v1nqdda4aasacnx6v2e580.jpg"/>
glances description of the work interface :
the upper part is CPU , Load (load), Mem (Memory usage), Swap usage of the (swap partition). In the upper part of the network interface
Most of the right is Processes usage of the (process). Typically, the following fields are included:
VIRT: Virtual Memory size RES: The amount of physical memory the process consumes%CPU: The CPU usage that the process consumes%MEM: the percentage of physical memory and total memory consumed by the process PID: Process ID Number User: Process Owner's username NI: Process priority S: process state, where S indicates hibernation, R is running, and Z represents a zombie state. time+: Total CPU time Io_r and Io_w when the process starts: read/write I/O rate of the process name: process names
the lower part of the graph is the disk Usage of I/O and disk-mounted partitions.
also glances You can run the tool interactively, and users can use the following shortcut keys:
H: Show help information Q: Leave program exit C: Sort system process by CPU real-time load m: Sort system process by memory usage I: Sort system process by I/O usage P: Sort by process name D: Show Disk read and write status W: Delete log file L: Display Show log S: Display sensor information F: Display System Information 1: Show the usage of each CPU core in turn (secondary option is only used on multicore CPU system)
Four . Glances of advanced Applications
glances The result output method
Let glances Output HTML format File , need a HTTP server.
Install the relevant package first
[Email protected]]# yum Install PYTHON-JINJA2
[[Email protected]~]# glances-f/usr/local/nginx/html/-o html
below you can use Chrom Browser Input URL : http://localhost/usr/local/nginx/html/glances.html , the result
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/05/wKioL1R1v6CRWHd1AAGIbupUNjk481.jpg "title=" 3.png " alt= "Wkiol1r1v6crwhd1aagibupunjk481.jpg"/>
Output CSV format
the file takes a comma-separated value ( CSV ), and you can import it directly into a spreadsheet.
We downloaded to the local to view:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/54/06/wKiom1R1vzrjl6ySAAGZWgKz4Fw854.jpg "title=" 4.png " alt= "Wkiom1r1vzrjl6ysaagzwgkz4fw854.jpg"/>
glances Server / How clients work
glances Support Server / the way the client works enables remote monitoring. First, assume
Server IP Address: 172.16.249.230
Client IP Address: 172.16.249.46
Make sure both are already installed. glances package.
First start on the server side;
[[Email protected]]# glances-s-B 172.16.249.230Glances server isrunning on 172.16.249.230:61209
can see glances The port number used is 61209 , so the user needs to make sure that the firewall opens this port.
Below, the client uses the following command to connect to the server
# glances-c172.16.249.230
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/05/wKioL1R1wA7AZuRGAAKYVQKUqqA643.jpg "title=" 5.png " alt= "Wkiol1r1wa7azurgaakyvqkuqqa643.jpg"/>
through glances Output Color Understanding system Performance
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/06/wKiom1R1v52S4IG9AARAnuS_wM0822.jpg "title=" 6.png " alt= "Wkiom1r1v52s4ig9aaranus_wm0822.jpg"/>
Green performance is good, no additional work is required; CPU usage, disk space usage, and memory usage are lower than 50% , the system load is lower than 0.7 ).
Blue indicates that there are some minor problems with system performance, and users should begin to focus on system performance; CPU usage, disk space usage, and memory utilization are 50%-70% between the system load and the 0.7-1 between).
Magenta indicates a performance alarm and should take steps such as backing up data; (At this point CPU usage, disk space usage, and memory utilization are 70%-90% between, the system loads in the 1-5 between).
Red indicates a serious performance problem and may be down; CPU usage, disk space usage, and memory utilization are greater than 90% , the system load is greater than 5 ).
So far, the introduction to the use of process management tools on CentOS is all over! This paper introduces the more advanced and practical enhanced process management tools on CentOS6, which is more advantageous than the process management tools brought by the system, hoping to help you!
This series of articles reference:
Http://zh.wikipedia.org/zh-cn/Htop
http://www.ibm.com/developerworks/cn/linux/1304_caoyq_glances/
Http://www.cnblogs.com/mchina/archive/2013/03/15/2858041.html
This article is from "Dragon Guardian" blog, please make sure to keep this source http://sohudrgon.blog.51cto.com/3088108/1583048
Process management tools under Linux (iii): Glances