Resource use monitoring tools glances

glances is an open source command line tool for a monitoring system for Linux, BSD, which uses Python language development, can monitor CPU, load, memory, disk I / O, network traffic, file system, system temperature and other information. This article describes the glances of the use of methods and techniques to help Linux system administrators understand the server performance. Introduction glances can provide monitoring and analyzing performance data capabilities for Unix and Linux performance experts, including:
  • CPU usage
  • Memory Usage
  • Kernel statistics and run queue information
  • Disk I / O speed, and transmit the read / write ratio
  • File system space available
  • Disk Adapter
  • Network I / O speed, and transmit the read / write ratio
  • Page and page space velocity
  • The process consumes the most resources
  • Computer information systems and resources
glances tool can display important system information in real time on the user's terminal, and dynamically update it. This efficient tool can work on any terminal screen. In addition, it does not consume a lot of CPU resources, usually less than two percent. glances data displayed on a screen, and update it every two seconds. You can also change your own this time interval is longer or shorter value. glances tool can also capture the same data to a file, to facilitate later analysis and graphing reports. Output files can be (.csv) format or html format spreadsheet. Two methods for installing glances installation methods may generally have two glances. The first way is by compiling the source code, the method is relatively complicated additional packages may encounter dependency problems. Another is to use a specific software package management tool to install glances, this method is relatively simple. As used herein, the latter should be noted that in CentOS specific package management tool to install. glances must first configure EPEL repo, and then use the tool to install pip glances. About pip packages usually Linux system administrator, there are two ways to install a Python package: one is to install the software from the warehouse through the system's package management tools (such as apt-get), one is own by Python package management tool (such as PIP or easy_install) Python Cheese Shop downloaded from the installation. I recommend using pip. pip is a tool to install and manage Python packages easy_install can replace, install a Python library is a very handy tool functions like YUM. Note that after installing Python-pip, pip but not keyword pip-Python under CentOS and Fedora. First configure EPEL repo RHEL if both want to get high quality, high performance, high reliability, easy-to-use package update function (key free) and the need, then the Fedora Project launched EPEL (Extra Packages for Enterprise Linux, http : //fedoraproject.org/wiki/EPEL) just right for you. It is built by the Fedora community project to provide high quality software packages for RHEL and derived distributions such as CentOS, Scientific Linux and so on. Fitted EPEL, the same as in Fedora, you can yum install package-name, free installation software. EPEL installation is very simple:
#wget http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6
#rpm --import RPM-GPG-KEY-EPEL-6
#rm -f RPM-GPG-KEY-EPEL-6
#vi /etc/yum.repos.d/epel.repo
# create new
[epel]
name=EPEL RPM Repository for Red Hat Enterprise Linux
baseurl=http://ftp.riken.jp/Linux/fedora/epel/6/$basearch/
gpgcheck=1
enabled=0
Use pip install glances introduced here about the installation process: first to use YUM to install pip tool, and then use pip install glances and tools used to display system temperature software.
#yum --enablerepo=epel install Python Python-pip Python-devel gcc
# pip-Python install glances
Lm_sensors lm_sensors software installation software can help us to monitor the motherboard, CPU operating voltage, fan speed, temperature and other data. These data usually we can see in the motherboard BIOS. When we can run the machine through lm_sensors at any time to monitor the temperature of the CPU, because the CPU can be prevented Oh protection overheating will burn. lm_sensors software to monitor data can be recalled and displayed glances.
# yum install lm_sensors
# pip-Python install PySensors
glances use
glances 是一个命令行工具包括如下命令选项:
-b:显示网络连接速度 Byte/ 秒
-B @IP|host :绑定服务器端 IP 地址或者主机名称
-c @IP|host:连接 glances 服务器端
-C file:设置配置文件默认是 /etc/glances/glances.conf
-d:关闭磁盘 I/O 模块
-e:显示传感器温度
-f file:设置输出文件(格式是 HTML 或者 CSV)
-m:关闭挂载的磁盘模块
-n:关闭网络模块
-p PORT:设置运行端口默认是 61209
-P password:设置客户端 / 服务器密码
-s:设置 glances 运行模式为服务器
-t sec:设置屏幕刷新的时间间隔,单位为秒,默认值为 2 秒,数值许可范围:1~32767
-h : 显示帮助信息
-v : 显示版本信息
1 glances working interface shown in FIG 1.glances worksurface [caption id = "attachment_2016" align = "aligncenter" width = "564"] Resource use monitoring tools glances using the resource monitoring tools glances [/ caption] glances worksurface Note: in the upper portion of FIG. 1 a CPU, load (load), Mem (memory usage), swap (swap) usage. In the upper portion of FIG. 1 is a network interface, Processes (process) usage. Typically comprises the following fields:
VIRT: 虚拟内存大小
RES: 进程占用的物理内存值
%CPU:该进程占用的 CPU 使用率
%MEM:该进程占用的物理内存和总内存的百分比
PID: 进程 ID 号
USER: 进程所有者的用户名
TIME+: 该进程启动后占用的总的 CPU 时间
IO_R 和 IO_W: 进程的读写 I/O 速率
NAME: 进程名称
NI: 进程优先级
S: 进程状态,其中 S 表示休眠,R 表示正在运行,Z 表示僵死状态。
In the lower part of FIG. 1 is a sensor for detecting the temperature of the CPU. In the lower portion of Figure 1 is the use of disk I / O's. Further glances can run the interactive tool, the user can use the following shortcut keys:
h : 显示帮助信息
q : 离开程序退出
c :按照 CPU 实时负载对系统进程进行排序
m :按照内存使用状况对系统进程排序
i:按照 I/O 使用状况对系统进程排序
p: 按照进程名称排序
d : 显示磁盘读写状况
w : 删除日志文件
l :显示日志
s: 显示传感器信息
f : 显示系统信息
1 :轮流显示每个 CPU 内核的使用情况(次选项仅仅使用在多核 CPU 系统)
The results output method of advanced applications glances glances let glances HTML output file, first install the relevant software package
# pip-Python install Jinja2
# glances -o HTML -f /var/www/html
Here you can use the Firefox browser, enter the URL: http: //localhost/glances.html, results shown in Figure 2. 2. FIG HTML output file [caption id = "attachment_2017" align = "aligncenter" width = "509"] Resource use monitoring tools glances using the resource monitoring tools glances [/ caption] output csv file format of the comma-separated value (CSV) format, and you can be directly imported into a spreadsheet.
# glances -o CSV -f /home/cjh/glances.csv
Calc libreoffice below using the tool to open the csv file format (FIG. 3)
#libreoffice --calc %U /tmp/glances.csv
Figure 3. libreoffice calc tool to open the csv file format [caption id = "attachment_2018" align = "aligncenter" width = "569"] Resource use monitoring tools glances use the resource monitoring tools glances [/ caption] glances server / client works glances support server / client work, you can achieve remote monitoring. First, assume that the server IP address: 10.0.2.14 client IP address: 10.0.2.15 to ensure that both are already installed glances package. First start on the server side;
# glances -s -B 10.0.2.15
glances server is running on 10.0.2.15:61209
You can see the port number is 61209 glances use, so users need to make sure the firewall to open the ports. The following server 4 connected to the client using the following command:
# glances – c 10.0.2.15
4. FIG client connection server [caption id = "attachment_2019" align = "aligncenter" width = "580"] Resource use monitoring tools glances using the resource monitoring tools glances [/ caption] Note that the lower left corner of Figure 4 shows "Connected to 10.0.2.15"> represents The client has successfully connected to the server. By understanding glances output color performance glances FIG 5. is an output interface [caption id = "attachment_2020" align = "aligncenter" width = "570"] Resource use monitoring tools glances Resource use monitoring tools glances [/ caption] Green indicates good performance, without having to do any extra work; (this time CPU usage, memory usage and disk space usage below 50%, the system load is lower than 0.7). Blue represents the performance of the system there are some small problems, users should be concerned about system performance; (and the CPU usage, disk space usage and memory usage between 50% -70%, the system load between 0.7-1) . Magenta indicates alarm performance, measures should be taken such as backup data; (At this time the CPU usage, disk space usage and memory usage is between 70% -90% between 1 and 5,, the system load). Red represents a serious performance problem, may freeze; (At this time the CPU usage, disk space usage and memory usage is greater than 90%, the system load is greater than 5). References glances at the official website, you can view more information about the glances of. In the developerWorks Linux zone, find Linux developers (including entry to Linux) more resources to prepare. The developerWorks Chinese community. Developer-driven blog, forums, groups, and wikis, and communicate this switched with other developerWorks users: http: //www.ibm.com/developerworks/cn/linux/1304_caoyq_glances/index.html operation and maintenance of survival time to sort: Use resource monitoring tool glances http://www.ttlsa.com/html/2010.html

Reproduced in: https: //my.oschina.net/766/blog/211171

Guess you like

Origin blog.csdn.net/weixin_34126557/article/details/91493181