3,496 瀏覽數

Linux command – glances

在 Linux 系統下,可以透過不同的工具來檢視 CPU , Memory ,I/O (Disk, Network) 目前狀態.或是直接透過 glances 程式來檢視系統效能.

測試環境為 Ubuntu 16.04 x86_64(虛擬機)

root@ubuntu:~# apt install glances
root@ubuntu:~# glances

預設每秒更新一次系統資訊,不想要這麼快可以使用參數 -t sec 來指定更新率.

root@ubuntu:~# glances -t 5

狀態會以顏色來區分重要性.
GREEN(綠色): OK (everything is fine)
BLUE(藍色): CAREFUL (need attention)
VIOLET(紫蘿蘭色): WARNING (alert)
RED(紅色): CRITICAL (critical)

監控時可以透過 hot keys 來設定.
ENTER – Set the process filter
a – Sort process list automatically
A – Enable/disable Application Monitoring Process
b – Switch between bit/s or Byte/s for network I/O
B – View disk I/O counters per second
c – Sort processes by CPU usage
d – Show/hide disk I/O stats
D – Enable/disable Docker stats
e – Enable/disable top extended stats
E – Erase current process filter
f – Show/hide file system and folder monitoring stats
F – Switch between file system used and free space
g – Generate graphs for current history
h – Show/hide the help screen
i – Sort processes by I/O rate
I – Show/hide IP module
l – Show/hide log messages
m – Sort processes by MEM usage
M – Reset processes summary min/max
n – Show/hide network stats
N – Show/hide current time
p – Sort processes by name
q|ESC – 離開 Glances 程式.
Q – Show/hide IRQ module
r – Reset history
R – Show/hide RAID plugin
s – Show/hide sensors stats
t – Sort process by CPU times (TIME+)
T – View network I/O as combination
u – Sort processes by USER
U – View cumulative network I/O
w – Delete finished warning log messages
W – Show/hide Wifi module
x – Delete finished warning and critical log messages
z – Show/hide processes stats
0 – Enable/disable Irix/Solaris mode
1 – 用來切換 CPU 顯示方式,可以為 global CPU 或是 per-CPU 的狀態.
2 – Enable/disable left sidebar 為 Tasks 的狀態.
3 – Enable/disable the quick look module
4 – Enable/disable all but quick look and load module
5 – Enable/disable top menu (QuickLook, CPU, MEM, SWAP and LOAD)
6 – Enable/disable mean GPU mode
/ – Switch between process command line or command name

預設是沒有顯示 GPU 的目前狀態,這時候需要使用到 pip (Python 的軟體套件管理系統)來新增 GPU 選項.

root@ubuntu:~# apt-get install -y python-pip
root@ubuntu:~# pip install glances[gpu]
root@ubuntu:~# sudo glances

發表迴響