1. 程式人生 > >Linux性能監控工具:Glances部署實錄

Linux性能監控工具:Glances部署實錄

linux python glances

[root@king01 ~]# yum install -y zlib zlib-devel bzip2 bzip2-devel ncurses ncurses-devel readline readline-devel openssl openssl-devel openssl-static gdbm gdbm-devel sqlite sqlite-devel [root@king01 ~]# tar zxvf Python-3.6.1.tgz [root@king01 ~]# cd Python-3.6.1 [root@king01 Python-3.6.1]# ./configure --prefix=/usr/local/python [root@king01 Python-3.6.1]# make [root@king01 Python-3.6.1]# make install [root@king01 ~]# rm -rf /usr/bin/python [root@king01 ~]# ln -s /usr/local/python/bin/python3.6 /usr/bin/python [root@king01 ~]# ll /usr/bin/python lrwxrwxrwx 1 root root 31 Mar 16 05:47 /usr/bin/python -> /usr/local/python/bin/python3.6 [root@king01 ~]# python -V Python 3.6.1


[root@king01 ~]# which yum
/usr/bin/yum
[root@king01 ~]# vi /usr/bin/yum
#!/usr/bin/python2.6


[root@king01 ~]# tar zxvf psutil-5.4.3.tar.gz
[root@king01 ~]# cd psutil-5.4.3
[root@king01 psutil-5.4.3]# python setup.py install


[root@king0 ~]# vi /etc/profile
PATH=$PATH:/usr/local/python/bin
[root@king01 ~]# source /etc/profile


[root@king01 ~]# pip3 install glances
Collecting glances
  Downloading Glances-2.11.1.tar.gz (5.7MB)
    100% | 5.7MB 18kB/s 
Requirement already satisfied: psutil>=2.0.0 in /usr/local/python/lib/python3.6/site-packages/psutil-5.4.3-py3.6-linux-x86_64.egg (from glances)
Installing collected packages: glances
  Running setup.py install for glances ... done
Successfully installed glances-2.11.1


[root@king01 ~]# glances
king01 (CentOS 6.5 64bit / Linux 2.6.32-431.el6.x86_64)                                                                                                        Uptime: 4:49:23
CPU  [|                                             3.2%]   CPU       3.2%  nice:     0.0%  ctx_sw:    84   MEM     66.1%  active:     145M   SWAP     11.3%   LOAD    1-core
MEM  [|||||||||||||||||||||||||||||                66.1%]   user:     2.3%  irq:      0.0%  inter:    110   total:   490M  inactive:   248M   total:   4.00G   1 min:    0.04
SWAP [|||||                                        11.3%]   system:   1.0%  iowait:   0.0%  sw_int:   126   used:    324M  buffers:   12.2M   used:     464M   5 min:    0.02
                                                            idle:    96.8%  steal:    0.0%                  free:    166M  cached:     121M   free:    3.55G   15 min:   0.02
NETWORK     Rx/s   Tx/s   TASKS  81 (125 thr), 1 run, 80 slp, 0 oth sorted automatically by cpu_percent, flat view
eth0        768b    3Kb
lo          256b   256b     CPU%  MEM%  VIRT   RES   PID USER        NI S     TIME+   R/s   W/s Command 
                             3.2   5.6  519M 27.3M 14682 root         0 R   0:01.32     0     0 /usr/local/python/bin/python3.6 /usr/local/python/bin/glances
DISK I/O     R/s    W/s      0.0   0.1 18.9M  704K     1 root         0 S   0:06.78     0     0 /sbin/init
sda1           0      0      0.0   0.0     0     0     2 root         0 S   0:00.00     0     0 kthreadd
sda2           0    13K      0.0   0.0     0     0     3 root         0 S   0:00.00     0     0 migration/0
sda3           0      0      0.0   0.0     0     0     4 root         0 S   0:00.60     0     0 ksoftirqd/0
sda4           0      0      0.0   0.0     0     0     5 root         0 S   0:00.00     0     0 migration/0
                             0.0   0.0     0     0     6 root         0 S   0:00.20     0     0 watchdog/0
FILE SYS    Used  Total      0.0   0.0     0     0     7 root         0 S   0:05.17     0     0 events/0
/ (sda2)   4.11G   197G      0.0   0.0     0     0     8 root         0 S   0:00.00     0     0 cgroup
/boot      37.8M   484M      0.0   0.0     0     0     9 root         0 S   0:00.00     0     0 khelper
/usr       10.9G   291G      0.0   0.0     0     0    10 root         0 S   0:00.00     0     0 netns
                             0.0   0.0     0     0    11 root         0 S   0:00.00     0     0 async/mgr
                             0.0   0.0     0     0    12 root         0 S   0:00.00     0     0 pm
                             0.0   0.0     0     0    13 root         0 S   0:00.70     0     0 sync_supers
                             0.0   0.0     0     0    14 root         0 S   0:00.70     0     0 bdi-default
                             0.0   0.0     0     0    15 root         0 S   0:00.00     0     0 kintegrityd/0
                             0.0   0.0     0     0    16 root         0 S   0:01.43     0     0 kblockd/0
                             0.0   0.0     0     0    17 root         0 S   0:00.00     0     0 kacpid
                             0.0   0.0     0     0    18 root         0 S   0:00.00     0     0 kacpi_notify
                             0.0   0.0     0     0    19 root         0 S   0:00.00     0     0 kacpi_hotplug
                             0.0   0.0     0     0    20 root         0 S   0:00.00     0     0 ata_aux
                             0.0   0.0     0     0    21 root         0 S   0:00.00     0     0 ata_sff/0
                             0.0   0.0     0     0    22 root         0 S   0:00.00     0     0 ksuspend_usbd
2018-03-16 06:12:26       No warning or critical alert detected


Linux性能監控工具:Glances部署實錄