7

This could be a very naive question for many of you, but I have problem in answering this one, your help will be deeply appreciated.

I need to document the server on which I work, and it should include following heads:

  1. IP address ->
  2. Model-> (Dell....)
  3. CPU->(@X Quad-core ....)
  4. RAM->(48GB...)
  5. Adapter external->(Dell Perc...)
  6. Disk local->(6 x 1Tb raid....)
  7. Adapter external->(Dell Perc ...)
  8. Disk attached->(....)
  9. Capacity external disk->(.....)

In brackets, I have put the kind of documentation needed for each head.

Is there any one command (shell/bash) or a group of commands that can be used to get this kind of documentation for my server.

6
  • Is it all specifically Dell kit?
    – Chopper3
    Mar 1, 2012 at 16:05
  • No, its a HP kit
    – Angelo
    Mar 2, 2012 at 10:44
  • Thanks Angelo - in that case you simply want HP Systems Insight Manager - it's free and does everything you've asked for and more including patch/firmware management, alerting all manner of things.
    – Chopper3
    Mar 2, 2012 at 10:45
  • Hi Chopper3, I am using Linux OS and I need linux/shell/bash commands
    – Angelo
    Mar 2, 2012 at 11:24
  • Understood - just saying that if you got HP SIM I think you'd benefit
    – Chopper3
    Mar 2, 2012 at 12:23

6 Answers 6

5

Here's a quick script/collection of commands to get you started. Add commands (ifconfig, lspci, etc.) as you see fit:

#!/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

I can run a quick ssh loop or run this individually from a source host using something like: ssh targethost < hwcollect.sh

Example:

[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, 63 sectors/track, 52216 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       52216   419424988+  83  Linux
4

Facter, used in Puppet, will collect most of that information for you out of the box. It is fairly easy to add whatever other "facts" you want to collect to it.

2
  • 1
    But it means installing Puppet :(
    – ewwhite
    Mar 1, 2012 at 15:53
  • 2
    ...which may not be a bad thing :-)
    – voretaq7
    Mar 1, 2012 at 16:05
2

bunch of commands to get you started.

dmidecode

df -h

lscpu

free -g

lspci

lsusb

ip addr

uname -a

1

lshw is the command you looking for.

1
  • oddly, that was in my original answer but i couldn't get it to work, so i figured i must have dreamt it up. It works now, lol.
    – Sirex
    Mar 1, 2012 at 12:48
1

dmesg (aka Driver Message) will give you all this information, and far more besides.

Edit: Actually, it won't give you the IP address, but ifconfig will give you that.

0

We run ocs-ng for our Windows7 client management and „aptitude install ocsinventory-agent“ installs the debian/Linux agent. Also dmidecode is used for hardware inventory .

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .