系統監控
apachetop
監控 apache 伺服器的整體性能。基於 mytop。它會顯示當前的讀取進程、寫入進程的數量以及請求進程的總數。
ftptop
提供了當前所有連接到 ftp 伺服器的基本信息,如會話總數,正在上傳和下載的客戶端數量以及客戶端是誰。
mytop
監控 mysql 的線程和性能。它能讓你實時查看資料庫以及正在處理哪些查詢。
powertop
診斷與電量消耗和電源管理相關的問題
iotop
檢查 I/O 的使用情況,它按列顯示讀和寫的速率,每行代表一個進程。發生交換或 I/O 等待時,它會顯示進程消耗時間的百分比
vnstat
rx: 0 bit/s 0 p/s tx: 0 bit/s 0 p/s^C
wlp4s0 / traffic statistics
rx | tx
--------------------------------------+------------------
bytes 1.32 KiB | 2.52 KiB
--------------------------------------+------------------
max 2.78 kbit/s | 5.60 kbit/s
average 773 bit/s | 1.47 kbit/s
min 0 bit/s | 0 bit/s
--------------------------------------+------------------
packets 16 | 16
--------------------------------------+------------------
max 4 p/s | 4 p/s
average 1 p/s | 1 p/s
min 0 p/s | 0 p/s
--------------------------------------+------------------
time 14 seconds
絡流量監控工具,它的數據統計是由內核進行提供的,其消耗的系統資源非常少
ss
ss是iproute2的一部分, 命令能夠顯示的信息比 netstat 更多,也更快。如果你想查看統計結果的總信息,可以使用命令ss -s
ss -tn -o state established -p
查詢系統上所有使用 IPv4 所開啟的 sockets,並列出每個 sockets 所對應的應用程式:
sudo ss -t4lp
sudo ss -t4lpn
篩選器
列出從本機連線到 192.168.43.100
這台主機的所有連線:
ss -o state established dst 192.168.43.100
Netid Recv-Q Send-Q Local Address:Port Peer Address:Port
tcp 0 0 192.168.43.129:ssh 192.168.43.100:53954 timer:(keepalive,116min,0)
ss -o state established src 192.168.43.100
ss
指令可以自己指定port,篩選出自己需要的 sockets 資訊
ss -o state established '( dport = :ssh or sport = :ssh )'
Netid Recv-Q Send-Q Local Address:Port Peer Address:Port Process
tcp 0 0 192.168.122.1:38216 192.168.122.247:ssh timer:(keepalive,119min,0)
tcp 0 0 192.168.43.100:53954 192.168.43.129:ssh timer:(keepalive,110min,0)
ss -o state syn-recv
Netid Recv-Q Send-Q Local Address:Port Peer Address:Port
tcp 0 0 2001:288:7201:2::88:http 2402:7500:466:2f24:84b0:efb4:da74:3ab:51668 timer:(on,1.660ms,0)
tcp 0 0 ::ffff:120.115.2.88:http ::ffff:46.229.168.134:54402 timer:(on,848ms,0)
tcp 0 0 ::ffff:120.115.2.88:http ::ffff:46.229.168.137:45508 timer:(on,952ms,0)
tcp 0 0 2001:288:7201:2::88:http 2402:7500:567:5d8f::1:48538 timer:(on,1.084ms,0)
tcp 0 0 2001:288:7201:2::88:http 2402:7500:567:5d8f::1:48546 timer:(on,140ms,0)
tcp 0 0 2001:288:7201:2::88:http 2402:7500:567:5d8f::1:48539 timer:(on,1.084ms,0)
tcp 0 0 2001:288:7201:2::88:http 2001:288:759e:0:e8a0:1494:3694:c61b:49182 timer:(on,4.304ms,0)
tcp 0 0 2001:288:7201:2::88:http 2001:b400:e752:7989:160:a722:fb0d:f54f:46894 timer:(on,4.620ms,0)
tcp 0 0 2001:288:7201:2::88:http 2001:288:75d6:0:c0f:1b34:9fca:e79c:50063 timer:(on,372ms,0)
tcp 0 0 2001:288:7201:2::88:http 2402:7500:466:2f24:84b0:efb4:da74:3ab:51667
Last updated