Linux服务器服务记录,linux – 记录服务器详细信息

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值