danny 2006-11-19 18:53
Linux 查詢伺服器硬體規格的小程式
最近小丹尼在做公司硬體統計,由於linux伺服器太多了,懶得一台一台伺服器看硬體規格,所以找了個小套件支援一下,感覺上還不錯,分享給大家。
套件名稱:Hardware Lister (lshw)
官方網站:http://ezix.org/project/wiki/HardwareLiSter
授權形式:GPL
[color=blue](1) 下載套件 [/color]
官方載點: http://ezix.org/software/files/lshw-B.02.08.01.tar.gz
本站載點: http://www.ihao.org/download/lshw-B.02.08.01.tar.gz
[color=blue](2) 把原本的tar檔轉成rpm檔以方便往後管理[/color]
[code]rpmbuild -ta --with gui lshw-B.02.08.01.tar.gz[/code]
[color=blue](3)到/usr/src/redhat/RPMS/i386 下看看有沒有成功產生下列rpm檔案[/color]
[color=red]lshw-B.02.08.01-1.i386.rpm
lshw-debuginfo-B.02.08.01-1.i386.rpm
lshw-gui-B.02.08.01-1.i386.rpm[/color]
[color=blue](4)將上面三個rpm都裝起來[/color]
[code]rpm -ivh lshw-B.02.08.01-1.i386.rpm
rpm -ivh lshw-debuginfo-B.02.08.01-1.i386.rpm
rpm -ivh lshw-gui-B.02.08.01-1.i386.rpm[/code]
[color=blue](5)安裝完成,測試一下看看伺服器資訊有沒有出來[/color]
[code][root@mail i386]# lshw -short
H/W path Device Class Description
=========================================================
system System Name
/0 bus A7S266U2
/0/0 memory 64KB BIOS
/0/4 processor AMD Duron(TM)
/0/4/a memory 128KB L1 cache
/0/4/b memory 64KB L2 cache
/0/26 memory 512MB System Memory
/0/26/0 memory DIMM DRAM Synchronous [empty]
/0/26/1 memory DIMM DRAM Synchronous [empty]
/0/26/2 memory 256MB DIMM DRAM Synchronous
/0/26/3 memory 256MB DIMM DRAM Synchronous
/0/e8000000 bridge 740 Host
/0/e8000000/1 bridge Virtual PCI-to-PCI bridge (AGP)
/0/e8000000/1/0 display 65x/M650/740 PCI/AGP VGA Display Adapter
/0/e8000000/2 bridge SiS962 [MuTIOL Media IO]
/0/e8000000/2.1 bus SiS961/2 SMBus Controller
/0/e8000000/2.5 storage 5513 [IDE]
/0/e8000000/2.5/0 ide0 bus IDE Channel 0
/0/e8000000/2.5/0/0 /dev/hda disk 19GB ST320423A
/0/e8000000/2.5/0/0/1 /dev/hda1 disk Linux filesystem partition
/0/e8000000/2.5/0/0/2 /dev/hda2 disk Linux swap / Solaris partition
/0/e8000000/2.5/0/0/3 /dev/hda3 disk Linux filesystem partition
/0/e8000000/2.5/1 ide1 bus IDE Channel 1
/0/e8000000/2.5/1/0 /dev/hdc disk CD-524EA
/0/e8000000/2.5/1/0/0 /dev/hdc disk
/0/e8000000/2.7 multimedia Sound Controller
/0/e8000000/3 bus USB 1.0 Controller
/0/e8000000/3/1 usb1 bus OHCI Host Controller
/0/e8000000/3.1 bus USB 1.0 Controller
/0/e8000000/3.1/1 usb2 bus OHCI Host Controller
/0/e8000000/3.3 bus USB 2.0 Controller
/0/e8000000/3.3/1 usb3 bus EHCI Host Controller
/0/e8000000/4 eth2 network SiS900 PCI Fast Ethernet
/0/e8000000/d eth1 network 82557/8/9 [Ethernet Pro 100]
[/code]
其它參數
[code]lshw [format] [options... ] where format can be
-X to launch the GUI (if available)
-html to activate HTML mode
-xml to activate XML mode
-short to print hardware paths
-businfo to print bus information
and options can be
-enable TEST to enable a test
-disable TEST to disable a test
-class CLASS to limit the output to a given class
-C CLASS alias for -class CLASS
NOTE: to use some features (like DMI on x86 platforms), you need to run lshw as root or it will only report partial information. [/code]
END By Danny