1、查看CPU信息
# 查看cpu負載 uptime # cpu使用率 (沒有sar 則yum -y install sysstat) sar 1 1 top bn1 |grep %Cpu # 每個cpu使用率 sar -P ALL 1 1 ' top后按1,可動態查看 ' # top bn1 top n1 # 查看cpu個數、頻率、型號、廠商等詳細信息 cat /proc/cpuinfo lscpu # 獲取cpu名稱與主頻 cat /proc/cpuinfo | grep 'model name' | cut -f2 -d: | head -n1 | sed 's/^ //' # 獲取邏輯核數 cat /proc/cpuinfo | grep 'model name' | wc -l # 獲取物理核數 cat /proc/cpuinfo | grep 'physical id' | sort | uniq | wc -l # 查看cpu的flags cat /proc/cpuinfo | grep flags | uniq | cut -f2 -d : | sed 's/^ //' # 是否打開超線程(檢查 physical id * cpu cores 與 processor的比例 1:1為未開啟) cat /proc/cpuinfo
CPU負載‘load average: 0.02, 0.04, 0.05’,具體指的什么意思?
以單核CPU說明:
0.02, 0.04, 0.05 是1分鍾、5分鍾、15分鍾內系統的平均負荷
假設:CPU每分鍾最多處理100個進程
當負荷 0.2,則CPU在這1分鍾里只處理20個進程
當負荷 1.0,則CPU在這1分鍾里正好處理100個進程
當負荷 1.7,則CPU正在處理的100個進程以外,還有70個進程正排隊等着CPU處理
很顯然:單核的話,1.0是一個關鍵值,當這個值達到0.7,就應當引起注意。問題出在哪里,防止情況惡化
當負荷達到5.0,就表明你的系統有很嚴重的問題
詳細說明Linux系統負荷
2、內存、硬盤信息
cat /proc/meminfo # 內存信息 free -m # 內存使用 sar -r 1 1 # 內存使用率 df -hT # 磁盤容量、使用率
3、網絡相關信息
lspci |grep Ethernet |wc -l # 物理網卡個數 lspci |grep Ethernet # 每塊網卡信息 ip addr |grep "inet.*brd" |grep -E "eth|en| br0" # 網卡IP route -n |grep '^0.0.0.0' | awk '{print $2}' # 默認網關 cat /etc/resolv.conf |grep ^nameserver # DNS信息
4、操作系統信息
cat /etc/issue # OS版本信息 uname -a # OS版本信息 cat /proc/version # OS版本信息 cat /proc/stat # OS版本信息 cat /etc/centos-release #CentOS版本 uname -r #內核版本 getconf LONG_BIT #操作系統位數 cat /proc/mdstat # 由md設備驅動程序控制的RAID設備信息 cat /proc/modules # 可加載內核模塊的信息
