如何检查服务器配置?

如何检查服务器配置?

可能重复:
记录服务器详细信息

我使用 CentOS 时,如何检查服务器配置(如内存、处理器、磁盘等)?

答案1

一般来说,你会使用dmidecode。输出相当多,因此更具体的输出可以来自此处记录的脚本

#!/bin/bash
# hwcollect.sh - Collect general system information

# Hostname
echo -e "$HOSTNAME \n"

# Display system manufacturer, model, serial and other attributes
dmidecode -t 1 | egrep '(Manufacturer|Product|Serial)'
dmidecode -t 3 | egrep '(Height)';
dmidecode  -t processor| egrep '(Socket|Version)'
# Calculate installed RAM
dmidecode -t 17 | awk '( /Size/ && $2 ~ /^[0-9]+$/ ) { x+=$2 } END{ print "\t" "Installed Ram: " x "MB"}'

echo " "
echo "Disk Information"
# Filesystem mounts
df -h
# Display disk partition table    
fdisk -l

这将产生如下结果:

[root@xetra ~]# ./hwcollect.sh
Pseudo-terminal will not be allocated because stdin is not a terminal.
Test_Server 

        Manufacturer: HP
        Product Name: ProLiant DL380 G6
        Serial Number: 2UX12345KT      
        Height: 2 U
        Socket Designation: Proc 1
        Version: Intel(R) Xeon(R) CPU X5570 @ 2.93GHz            
        Upgrade: Socket LGA1366
        Socket Designation: Proc 2
        Version: Intel(R) Xeon(R) CPU X5570 @ 2.93GHz            
        Upgrade: Socket LGA1366
        Installed Ram: 32768MB

相关内容