数据监测--服务器系统硬件信息、cpu、温度

搬出我多年前的笔记内容吧

 

【主板信息】
dmidecode |grep -A16 "System Information$"
【CPU信息】
#查看CPU信息(型号)
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
# 查看物理CPU个数
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
# 查看每个物理CPU中core的个数(即核数)
cat /proc/cpuinfo| grep "cpu cores"| uniq
# 查看逻辑CPU的个数
cat /proc/cpuinfo| grep "processor"| wc -l
#查看cpu信息
lscpu
 
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    1
Core(s) per socket:    2
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 58
Model name:            Intel(R) Pentium(R) CPU G2030 @ 3.00GHz
Stepping:              9
CPU MHz:               2999.882
BogoMIPS:              6000.07
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              3072K
NUMA node0 CPU(s):     0,1

#查看每个cpu信息

cat /proc/cpuinfo
 
 
【内存信息】 
#查看总内存大小
cat /proc/meminfo | grep MemTotal
#查看内存条厂家
dmidecode -t memory | grep Manufacturer
#查看概要信息
free -h
              total        used        free      shared  buff/cache   available
Mem:            15G        4.7G        9.5G        8.9M        1.3G         10G
Swap:           31G          0B         31G

#内存及插槽信息  dmidecode以一种可读的方式dump出机器的DMI(Desktop Management Interface)信息

dmidecode -t memory
#显示插槽个数和每个插槽里内存条的大小
dmidecode -t memory | grep Size  
 
【硬盘信息】
#查看硬盘和分区分布
lsblk
 
#查看硬盘和分区分布详细
fdisk -l
df -h
#查看硬盘信息
fdisk -l | grep "Disk /dev/sdb"
#查看1T盘个数
fdisk -l | grep 1000.2 | wc -l
#查看硬盘型号
smartctl --all /dev/sda
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.10.0-514.el7.x86_64] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
 
=== START OF INFORMATION SECTION ===
Device Model:     ST1000DM010-2EP102
Serial Number:    W9A54QHZ
LU WWN Device Id: 5 000c50 09ded93c3
Firmware Version: CC43
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    7200 rpm
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ATA8-ACS T13/1699-D revision 4
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Fri Dec 13 15:25:48 2019 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

【bios信息】

#查看bios
dmidecode -t bios
 
【网卡信息】
#查看网卡硬件
lspci |grep Eth
#查看网卡ip等
ifconfig
#查看指定网卡信息,如是否连通网线
ethtool eth0
 
【CPU温度】
#安装
yum install -y lm_sensors
#监测传感器
sh -c "yes|sensors-detect"
#查看cpu温度
[root@localhost ~]# sensors
acpitz-virtual-0
Adapter: Virtual device
temp1:        +27.8°C  (crit = +119.0°C)
temp2:        +29.8°C  (crit = +119.0°C)
 
coretemp-isa-0000
Adapter: ISA adapter
Physical id 0:  +46.0°C  (high = +100.0°C, crit = +100.0°C)
Core 0:         +42.0°C  (high = +100.0°C, crit = +100.0°C)
Core 1:         +44.0°C  (high = +100.0°C, crit = +100.0°C)
 
it8782-isa-0a40
Adapter: ISA adapter
in0:          +0.66 V  (min =  +0.00 V, max =  +4.08 V)  ALARM
in1:          +1.34 V  (min =  +0.00 V, max =  +4.08 V)  ALARM
in2:          +3.36 V  (min =  +0.00 V, max =  +4.08 V)  ALARM
+5V:          +6.02 V  (min =  +0.00 V, max =  +8.16 V)  ALARM
in4:          +2.29 V  (min =  +0.00 V, max =  +4.08 V)  ALARM
5VSB:         +5.98 V  (min =  +0.00 V, max =  +8.16 V)  ALARM
Vbat:         +3.23 V  
fan1:           0 RPM  (min =    0 RPM)
fan2:           0 RPM  (min =    0 RPM)
fan3:           0 RPM  (min =    0 RPM)
temp1:        +53.0°C  (low  = -128.0°C, high = +127.0°C)  sensor = thermal diode
temp2:        +53.0°C  (low  = -128.0°C, high = +127.0°C)  sensor = thermal diode
temp3:        -55.0°C  (low  = +48.0°C, high = +127.0°C)  sensor = Intel PECI
intrusion0:  ALARM

  

 
【其他】
uname -a # 查看内核/操作系统/CPU信息的linux系统信息
head -n l /etc/issue # 查看操作系统版本
cat /proc/cpuinfo # 查看CPU信息
hostname # 查看计算机名的linux系统信息命令
lspci -tv # 列出所有PCI设备
lsusb -tv # 列出所有USB设备的linux系统信息命令
env # 查看环境变量资源
free -m # 查看内存使用量和交换区使用量
grep MemTotal /proc/meminfo # 查看内存总量
grep MemFree /proc/meminfo # 查看空闲内存量
uptime # 查看系统运行时间、用户数、负载
cat /proc/loadavg # 查看系统负载磁盘和分区
swapon -s # 查看所有交换分区
hdparm -i /dev/hda # 查看磁盘参数(仅适用于IDE设备)
dmesg | grep IDE # 查看启动时IDE设备检测状况网络
iptables -L # 查看防火墙设置
route -n # 查看路由表
netstat -lntp # 查看所有监听端口
netstat -antp # 查看所有已经建立的连接
netstat -s # 查看网络统计信息进程
ps -ef # 查看所有进程
top # 实时显示进程状态用户
w # 查看活动用户
id # 查看指定用户信息
last # 查看用户登录日志
cut -d: -f1 /etc/passwd # 查看系统所有用户
cut -d: -f1 /etc/group # 查看系统所有组
crontab -l # 查看当前用户的计划任务服务
chkconfig –list # 列出所有系统服务
chkconfig –list | grep on # 列出所有启动的系统服务程序
cat /proc/cpuinfo :查看CPU相关参数的linux系统命令
cat /proc/partitions :查看linux硬盘和分区信息的系统信息命令
cat /proc/meminfo :查看linux系统内存信息的linux系统命令
cat /proc/version :查看版本,类似uname -r
cat /proc/ioports :查看设备io端口
cat /proc/interrupts :查看中断
cat /proc/pci :查看pci设备的信息
cat /proc/swaps :查看所有swap分区的信息
 
 
 补充:
【借助PERF工具分析CPU使用率】
sar -P ALL -u 1 10
perf record -a -e cycles -o cycle.perf -g sleep 10
perf report -i cycle.perf | more
 
 
posted @ 2022-04-14 14:42  huangyn  阅读(389)  评论(0)    收藏  举报