linux – 记录服务器详细信息

前端之家收集整理的这篇文章主要介绍了linux – 记录服务器详细信息前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
对于你们许多人来说,这可能是一个非常天真的问题,但我在回答这个问题时遇到了问题,我们将非常感谢你的帮助.

我需要记录我工作的服务器,它应包括以下主题

> IP地址 – >
>模型 – > (戴尔….)
> cpu->(@ X四核……)
> RAM->(48GB ……)
>外部适配器 – >(戴尔Perc …)
>磁盘本地 – >(6 x 1Tb raid ….)
>外部适配器 – >(戴尔Perc …)
>附加磁盘 – >(….)
>容量外置磁盘 – >(…..)

在括号中,我已经提供了每个头所需的文档类型.

是否有任何一个命令(shell / bash)或一组可用于为我的服务器获取此类文档的命令.

解决方法

这是一个快速的脚本/命令集合,可以帮助您入门.根据需要添加命令(ifconfig,lspci等):
#!/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

我可以运行一个快速的ssh循环,或者使用类似的东西从源主机单独运行它:ssh targethost< hwcollect.sh 例:

[root@xetra ~]# ssh Test_Server < 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

Disk Information
Filesystem            Size  Used Avail Use% Mounted on
/dev/cciss/c0d0p2      20G  5.1G   14G  28% /
/dev/cciss/c0d0p7     3.0G   74M  2.7G   3% /tmp
/dev/cciss/c0d0p6     5.9G  2.3G  3.3G  42% /var
/dev/cciss/c0d0p3     9.7G  4.7G  4.6G  51% /usr
/dev/cciss/c0d0p1      99M   39M   55M  42% /boot
/dev/cciss/c0d0p8     573G  433G  140G  76% /scratch
/dev/cciss/c0d0p9     1.1T  702G  348G  67% /data
tmpfs                  16G     0   16G   0% /dev/shm
/dev/sda1             400G  298G  103G  75% /data/datatest

Disk /dev/cciss/c0d0: 1800.2 GB,1800280694784 bytes
255 heads,63 sectors/track,218871 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d0p1   *           1          13      104391   83  Linux
/dev/cciss/c0d0p2              14        2624    20972857+  83  Linux
/dev/cciss/c0d0p3            2625        3929    10482412+  83  Linux
/dev/cciss/c0d0p4            3930      218871  1726521615    5  Extended
/dev/cciss/c0d0p5            3930        6018    16779861   82  Linux swap / Solaris
/dev/cciss/c0d0p6            6019        6801     6289416   83  Linux
/dev/cciss/c0d0p7            6802        7193     3148708+  83  Linux
/dev/cciss/c0d0p8            7194       81891   600011653+  83  Linux
/dev/cciss/c0d0p9           81892      218871  1100291818+  83  Linux

Disk /dev/sda: 429.4 GB,429496729600 bytes
255 heads,52216 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       52216   419424988+  83  Linux
原文链接:https://www.f2er.com/linux/400042.html

猜你在找的Linux相关文章