glances 系统监控
glances 是一款用于 Linux、BSD 的开源命令行系统监视工具,它使用 Python 语言开发,能够监视 CPU、负载、内存、磁盘 I/O、网络流量、文件系统、系统温度等信息。
glances 可以为 Unix 和 Linux 性能专家提供监视和分析性能数据的功能,其中包括:
- CPU 使用率;内存使用情况;内核统计信息和运行队列信息;磁盘 I/O 速度、传输和读 / 写比率;文件系统中的可用空间;磁盘适配器;网络 I/O 速度、传输和读 / 写比率;页面空间和页面速度;消耗资源最多的进程;计算机信息和系统资源
1. 安装 与使用
[root@zhb65 /]# yum install glances
Loaded plugins: fastestmirror, langpacks
ADDOPS-base | 2.9 kB 00:00:00
base | 2.9 kB 00:00:00
centosplus | 2.9 kB 00:00:00
epel | 2.9 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package glances.noarch 0:2.5.1-1.el7 will be installed
--> Processing Dependency: python-psutil >= 2.0.0 for package: glances-2.5.1-1.el7.noarch
--> Processing Dependency: python-setuptools for package: glances-2.5.1-1.el7.noarch
--> Running transaction check
---> Package python-setuptools.noarch 0:0.9.8-7.el7 will be installed
--> Processing Dependency: python-backports-ssl_match_hostname for package: python-setuptools-0.9.8-7.el7.noarch
---> Package python2-psutil.x86_64 0:5.6.7-1.el7 will be installed
--> Running transaction check
---> Package python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7 will be installed
--> Processing Dependency: python-ipaddress for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
--> Processing Dependency: python-backports for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
--> Running transaction check
---> Package python-backports.x86_64 0:1.0-8.el7 will be installed
---> Package python-ipaddress.noarch 0:1.0.16-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================================================================================================================================================================================================================================
Package Arch Version Repository Size
============================================================================================================================================================================================================================================================================================================================
Installing:
glances noarch 2.5.1-1.el7 epel 440 k
Installing for dependencies:
python-backports x86_64 1.0-8.el7 base 5.8 k
python-backports-ssl_match_hostname noarch 3.5.0.1-1.el7 base 13 k
python-ipaddress noarch 1.0.16-2.el7 base 34 k
python-setuptools noarch 0.9.8-7.el7 base 397 k
python2-psutil x86_64 5.6.7-1.el7 epel 399 k
Transaction Summary
============================================================================================================================================================================================================================================================================================================================
Install 1 Package (+5 Dependent packages)
Total download size: 1.3 M
Installed size: 6.0 M
Is this ok [y/d/N]: y
Downloading packages:
(1/6): python-backports-1.0-8.el7.x86_64.rpm | 5.8 kB 00:00:00
(2/6): python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm | 13 kB 00:00:00
(3/6): python-ipaddress-1.0.16-2.el7.noarch.rpm | 34 kB 00:00:00
(4/6): python-setuptools-0.9.8-7.el7.noarch.rpm | 397 kB 00:00:00
(5/6): glances-2.5.1-1.el7.noarch.rpm | 440 kB 00:00:00
(6/6): python2-psutil-5.6.7-1.el7.x86_64.rpm | 399 kB 00:00:00
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 5.7 MB/s | 1.3 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : python2-psutil-5.6.7-1.el7.x86_64 1/6
Installing : python-backports-1.0-8.el7.x86_64 2/6
Installing : python-ipaddress-1.0.16-2.el7.noarch 3/6
Installing : python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch 4/6
Installing : python-setuptools-0.9.8-7.el7.noarch 5/6
Installing : glances-2.5.1-1.el7.noarch 6/6
Verifying : python-ipaddress-1.0.16-2.el7.noarch 1/6
Verifying : python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch 2/6
Verifying : python-backports-1.0-8.el7.x86_64 3/6
Verifying : glances-2.5.1-1.el7.noarch 4/6
Verifying : python2-psutil-5.6.7-1.el7.x86_64 5/6
Verifying : python-setuptools-0.9.8-7.el7.noarch 6/6
Installed:
glances.noarch 0:2.5.1-1.el7
Dependency Installed:
python-backports.x86_64 0:1.0-8.el7 python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7 python-ipaddress.noarch 0:1.0.16-2.el7 python-setuptools.noarch 0:0.9.8-7.el7 python2-psutil.x86_64 0:5.6.7-1.el7
Complete!
[root@zhb65 /]# glances
CPU [| 2.0%] CPU 2.0% nice: 0.0% MEM 73.9% active: 163M SWAP 0.0% LOAD 1-core
MEM [|||||||||||||||||||||||||||||||||||||||||||||||||||||| 73.9%] user: 1.7% irq: 0.0% total: 2.00G inactive: 1.66G total: 0 1 min: 0.00
SWAP [ 0.0%] system: 0.3% iowait: 0.0% used: 1.48G buffers: 0 used: 0 5 min: 0.00
idle: 98.0% steal: 0.0% free: 535M cached: 353M free: 0 15 min: 0.00
NETWORK Rx/s Tx/s TASKS 5 (253 thr), 1 run, 4 slp, 0 oth sorted automatically by memory_percent, flat view
eth0 340Kb 82Kb
lo 0b 0b CPU% MEM% VIRT RES PID USER NI S TIME+ IOR/s IOW/s Command
0.7 74.4 5.03G 1.49G 8 root 0 S 9h26:52 0 60K /bin/java -Xmx2688M -Xms2688M -Xmn960M -XX:MaxMetaspaceSize=512M -XX:MetaspaceSize=512M -XX:+UseConcMarkSweepGC -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 -XX:+ExplicitGCInvokesConcurrentAnd
FILE SYS Used Total 0.7 0.9 225M 18.8M 20497 root 0 R 0:00.18 0 0 /usr/bin/python /usr/bin/glances
_tion-log 196G 760G 0.0 0.2 114M 4.73M 20308 root 0 S 0:18.46 0 0 bash
_hostname 196G 760G 0.0 0.0 204K 4K 7 root 0 S 0:00.00 0 0 /usr/local/bin/dumb-init /usr/local/bin/bootstrap.sh
_tc/hosts 196G 760G 0.0 0.0 1004K 4K 1 root 0 S 0:48.23 0 0 /sbin/docker-init -- /usr/local/bin/dumb-init /usr/local/bin/bootstrap.sh
_olv.conf 196G 760G
_ker-init 4.31G 50.0G
_ib/lxcfs 1.16G 100.0G
Warning or critical alerts (one entry)
2024-04-07 17:28:22 2024-04-07 17:28:12 (ongoing) - MEM (73.0)