SHELL script for collecting DELL server hardware information

Source: Internet
Author: User

SHELL script for collecting DELL server hardware information

Recently, an asset list is required to collect the hardware information of the DELL server, including the following information:

1. Operating System Information (type, version, kernel, platform, host name)

2. motherboard information (manufacturer, model, serial number)

3. CPU information (model, quantity, number of physical cores)

4. Memory (number of items, single capacity)

5. Disk (quantity, single capacity, disk type, Raid level)

Install MegaRAID before execution. To improve work efficiency, use the SHELL script as follows:

#! /Bin/sh # getosinformationfunctionget_ OS _info () {release = 'cat/etc/redhat-release | awk '{print $1 "_" $3}' kname = 'uname-S' nodename = 'uname-N' kernal = 'uname-R' bit = 'uname-I 'printf "OS _RELEASE: $ release "_" $ bit \ n "printf" OS _DETAIL: $ kname $ nodename $ kernal $ bit \ n "} get_ OS _info # getvendor, model, sn... functionmotherboard () {vendor = 'dmidecode-t1 | grep "Manufacturer" | awk '{print $2} ''model = 'dmidecode-t1 | grep" Product "| awk' {print $4} ''sn = 'dmidecode-t1 | grep "Serial" | awk' {print $3} ''printf "MODEL: $ vendor $ model \ n "printf" SN: $ sn \ n "} motherboardfunctionmemory () {count = 'dmidecode-q-t172 | grep "Size" | grep-v "NoModuleInstalled" | awk '{print $2}' | uniq-c | awk '{print $1} ''capacity = 'dmidecode-q-t172 | grep "Size" | grep-v "NoModuleInstalled" | awk '{print $2}' | uniq-c | awk '{print $2} ''capacity = 'expr $ capacity/1024 'printf "MEM: $ count "*" $ capacity "G" \ n "} memoryfunctioncpuinfo () {cpu_model = 'cat/proc/cpuinfo | grep" modelname "| head-1 | awk-F: '{print $2} ''cpu _ count = 'cat/proc/cpuinfo | grep" coreid "| grep" 0 "| uniq-c | awk' {print $1} ''cpu _ total_cores = 'cat/proc/cpuinfo | grep "processor" | wc-l' single _ cores = 'expr $ cpu_total_cores/$ cpu_count 'printf "cpu: $ cpu_model ($ cpu_count "*" $ single_cores "Cores") \ n "} cpuinfofunctiondiskinfo () {raidlevel = '/opt/MegaRAID/MegaCli/MegaCli64-LDInfo-Lall-aALL | grep "RAID" | awk' {print $3} '| cut-b9-9 'disknumber ='/opt/MegaRAID/MegaCli/MegaCli64-LDInfo-Lall-aALL | grep "Drives" | awk-F ": "'{print $2}'' disktype ='/opt/MegaRAID/MegaCli/MegaCli64-PDList-aALL | grep "PDType" | head-1 | awk-F: '{print $2} ''diskcapacity ='/opt/MegaRAID/MegaCli/MegaCli64-PDList-aALL | grep" RawSize "| head-1 | awk' {print $3}'' printf" DISK: $ disknumber "*" $ diskcapacity "GB" $ disktype (RaidLevel: $ raidlevel) \ n "} diskinfo

The script execution result is as follows:

OS _RELEASE: CentOS_6.5_x86_64OS_DETAIL: linux511rv2.6.32-431. el6.x86 _ 64x86_64MODEL: DellR730SN: CDFGHJLMEM: 4*8 GCPU: Intel (R) Xeon (R) CPUE5-2630v3@2.40GHz (2*8 Cores) DISK: 2*279.396 GBSAS (RaidLevel: 1)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.