5

They are a mix of Red Hat and CentOS 5.x, I'd like to have something on one host that can check basics like cpu/mem/disk hardware, Model, HW RAID controllers, etc would be nice.

I have key based ssh authentication set up, but I do not want to have to install anything on these hosts. Worst case, I could scp something to /tmp, but no install please.

Near as I can see, either I need to install something, or it is something really basic that I would run on the machine, and then manually aggregate.

Am I stuck writing some Perl to run and process the output of dmidecode, lspci, etc?

If I do, I'll put it up someplace, and link to it.

Related questions that do not have the answer:
Get server hardware details for ubuntu server
How to find out details about hardware on the Linux machine? this one had a nice bit of shell script, but it errors.

3
  • Why do people keep suggesting I install stuff? There are a bunch of choices if I want to go that route, just looking at the problem, I don't see why ssh, run commands (lspci, lsusb, dmesg, dmidecode, look at /proc), then analyze on my server (ok to install what ever here, it could be a throwaway vm) isn't an option. Oct 12, 2010 at 23:17
  • In general you always need to think about build vs. buy. Is it more productive for you to cook up, debug and maintain scripts to gather inventory data, or to just use one of the thousands of applications out there to gather the data for you? You should have a really good reason to re-invent the wheel. Oct 14, 2010 at 15:35
  • 1
    Well, it's how can I inventory this large number of inherited machines that are not well documented, and some of which have not really been touched in any sense for over 500 days, yet are critical for production? So I'd rather not install anything. I could live with untaring some perl in /tmp, but no real installs please. I want to see what I have got, to better figure out what can be spared (those 500 day uptime boxes will be available by Jan 1), etc. Rebuilding everything over time. Oct 15, 2010 at 1:43

7 Answers 7

2

Maybe try http://www.cfg2html.com/ it's just one bash script that outputs to html, which you can upload/download to a central directory. However it's just the output from commands so it's pretty hard to put it in a structured format like sql/xml.

2

Without installing any new software on the remote systems, you can grab a raw snapshot of the remote machine's state with:

lspci > /tmp/`hostname`-lspci
tar -czvf `hostname`-proc-snapshot.tar.gz /proc /tmp/`hostname`-lspci --exclude=/proc/kcore

Then scp the tar archive from the remote server. This will get you: cpuinfo, meminfo, partitions, etc. Add more commands and temporary files for any additional information you may need (logical volumes, raid status, etc.)

As a minor bonus, you get an inventory of running processes on the remote machine at that instant.

1
  • Yup, throw in dmidecode, etc, and some processing to clean it all up and make a nice csv of it. Oct 15, 2010 at 1:44
2

You could install Spiceworks in a windows vm. It only uses ssh to inventory linux hosts.

2

Depending on if you have Python2 installed on your systems, you could also use Ansible.

ansible -m setup ${hostname}

This will output a nice JSON which includes CPU/RAM/HDD/Network and software configuration. Read the documentation for more information.

1
  • Ansible is probably the easiest long term. So long as the remote systems meet the minimum requirements (ssh access, sudo or su, and a very standard minimum version of python) you can get the data without anything special. You do have to install ansible on your master machine though...but it's worth it and a very excellent tool.
    – 0xSheepdog
    Oct 24, 2017 at 18:03
0

lshw command gives you a lot of hardware information and can output it in HTML or XML format...

1
  • lshw isn't available on CentOS or Redhat out of the box as it is in Ubuntu, and Ronald doesn't want to install applications ...
    – jsnfwlr
    Oct 12, 2010 at 0:30
0

If lshw is installed on the machines, you can use that, but it doesn't come pre-installed on Redhat and it's derivatives. There are RPM's out there for it, and you may be able to extract the required files from an RPM, SCP them to the machines, create a few symbolic links (most likely a link from /usr/sbin/lshw to the tmp location of the file, and from /usr/share/lshw to the tmp location of the folder) then you run lshw and remove the symbolic links afterwards. That is assuming you have root/sudo access ...

1
0

Copy hw-probe and hwinfo utilities to the temp directory on the server and run locally w/o installing anything. Just done this for one of my servers.

Example for CentOS 6:

  1. Connect to server

    ssh user@server
    
  2. Create a temp directory

    mkdir -p /tmp/hw-inventory
    cd /tmp/hw-inventory
    
  3. Download proper hwinfo and libx86emu rpm binary packages

    wget http://mirror.ghettoforge.org/distributions/gf/el/6/gf/x86_64/hwinfo-20.2-1.gf.el6.x86_64.rpm
    wget http://mirror.ghettoforge.org/distributions/gf/el/6/gf/x86_64/libx86emu-1.1-1.gf.el6.x86_64.rpm
    
  4. Extract them

    rpm2cpio hwinfo-21.47-4.1.x86_64.rpm | cpio -id
    rpm2cpio libx86emu-1.1-1.gf.el6.x86_64.rpm | cpio -id
    
  5. Get latest hw-probe script

    wget https://github.com/linuxhw/hw-probe/archive/master.zip
    unzip master.zip
    
  6. Create a probe

    sudo perl hw-probe-master/hw-probe.pl -all -upload -hwinfo-path ./usr/sbin/hwinfo
    
  7. Clear local temp directory

    cd ~/
    rm -fr /tmp/hw-inventory /root/HW_PROBE
    

The utility will return a permanent url to view collected hardware details and hardware related logs (like this).

I've just added an option -hwinfo-path to hw-probe:master to simplify your use case.

If you'd like to inventory many computers, then please see https://github.com/linuxhw/hw-probe#inventory.

enter image description here

I'm the author of the hw-probe project, feel free to ask any questions in the comments to this answer.

You must log in to answer this question.

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