linux – 记录服务器详细信息

linux – 记录服务器详细信息,第1张

概述对于你们许多人来说,这可能是一个非常天真的问题,但我在回答这个问题时遇到了问题,我们将非常感谢你的帮助. 我需要记录我工作的服务器,它应包括以下主题: > IP地址 – > >模型 – > (戴尔….) > CPU->(@ X四核……) > RAM->(48GB ……) >外部适配器 – >(戴尔Perc …) >磁盘本地 – >(6 x 1Tb raid ….) >外部适配器 – >(戴尔Per 对于你们许多人来说,这可能是一个非常天真的问题,但我在回答这个问题时遇到了问题,我们将非常感谢你的帮助.

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

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

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

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

解决方法 这是一个快速的脚本/命令集合,可以帮助您入门.根据需要添加命令(ifconfig,lspci等):
#!/bin/bash# hwcollect.sh - Collect general system information# Hostnameecho -e "$HOSTname \n"# display system manufacturer,model,serial and other attributesdmIDecode -t 1 | egrep '(Manufacturer|Product|Serial)'dmIDecode -t 3 | egrep '(Height)';dmIDecode  -t processor| egrep '(Socket|Version)'# Calculate installed RAMdmIDecode -t 17 | awk '( /Size/ &&  ~ /^[0-9]+$/ ) { x+= } END{ print "\t" "Installed Ram: " x "MB"}'echo " "echo "disk information"# filesystem mountsdf -h# display disk partition table    fdisk -l

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

[root@xetra ~]# ssh Test_Server < hwcollect.shPseudo-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: 32768MBdisk informationfilesystem            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% /datatmpfs                  16G     0   16G   0% /dev/shm/dev/sda1             400G  298G  103G  75% /data/datatestdisk /dev/cciss/c0d0: 1800.2 GB,1800280694784 bytes255 heads,63 sectors/track,218871 cylindersUnits = 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  linuxdisk /dev/sda: 429.4 GB,429496729600 bytes255 heads,52216 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes   Device Boot      Start         End      Blocks   ID  System/dev/sda1               1       52216   419424988+  83  linux
总结

以上是内存溢出为你收集整理的linux – 记录服务器详细信息全部内容,希望文章能够帮你解决linux – 记录服务器详细信息所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/1041239.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存