Saturday, December 18, 2010

Gathering Hardware Information in Linux

Undoubtedly one of the biggest struggles in getting used to working in Linux (specifically a server OS) is learning how to do the things you did with Windows and the GUI in a non-GUI environment. You really have to work on retraining your brain and your eyes.

I've started working on a risk management assessment exercise for my company. I've been using the documentation and structure provided by NIST (www.nist.gov) and one of the first steps is to properly and fully identify your systems. I had already gone through and inventoried all of the servers and switches and made note of things like the service tags, warranty expirations, number of drives, etc., but this exercise called for more in-depth information. Most of our servers, particularly the client-serving ones, are in a collocation facility so it's not possible to simply look at the hardware and ascertain things like whether or not the RAID controller is embedded or an HBA, and what kinds of drives they are, etc. Windows provides the Device Manager as a very quick and easy way to get hardware information, down to some pretty good detail. In Linux I found the same task to be more challenging: there are a variety of tools and utilities to use; they're not all included in your base install; the output can be cryptic and difficult to get through.

Here's a quick list of the resources I used/tried out to get the information I needed, starting with the ones with which I was already familiar and progressing to new finds.

/proc
This virtual directory has a lot of information about the current running system configuration, including some hardware components. Reading meminfo or cpuinfo gives good detail about the memory and the processor(s) installed as well as cpu capability from the flags field.

dmidecode
I like the amount of information you get from this tool. I wish it were a standard part of a base install because I think it's just easy to quickly get the info you need, especially if you make use of the flags or regular expressions to pull out the specific info you're looking for.


lspci
Very quick way to get basic information about the peripherals installed in the system. It essentially queries the /proc/pci file.

mpt-status
This tool turned out to be a lifesaver. I could not figure out how to get information on the physical drives in my system since it was using hardware RAID, masking the underlying physical structure of the drives to the OS. There is also apparently an added challenge when using LSI Logic RAID controllers, which is the default embedded controller installed in a lot of these cheaper Dell 1U servers. I had a pretty good guess that it was a 2-drive RAID 1 configuration since it was the same make/model as another onsite system, and I also had the info from Dell's site thanks to the service tag. I never like to let things like that lay though. What would happen if I didn't have all of that information? I should definitely know how to get it. <a href="http://freshmeat.net/projects/mptstatus/">The mpt-status tool </a> does not come installed either, but it's a fairly straightforward process to get it through package management. This tool lets you monitor the health and status of your RAID setup.

So, loads of options really for gathering the info I needed. The challenge again was simply figuring out which tools were best suited for my tasks, and then deciphering the output when I used them. That seems to really be one of the main aspects of Linux in general though. I would love to be able to use Dell's OMSA tool, but they don't officially support/make it for Ubuntu. There are various articles out there on compiling it from source and tweaking it to get it to work, but that's not the kind of things I'm psyched to do on a production box. Even if I got it working on a test machine I still would be loath to try it out because our servers are all different. They don't all have the same kernel versions, packages, etc. I think I will use the roundabout method for now.



No comments:

Post a Comment