[Melbourne-pm] asking your server for hardware details

David Dick ddick at aapt.net.au
Thu Nov 2 11:32:09 PST 2006


Geoff Crompton wrote:
> Hi,
> Do people know of any handy CPAN modules that help in working out
> hardware details, for systems programming?
>
> I'm writing a script that will answer the following sort of questions,
> to build up a catalog of information about our servers:
>
>  * how many hard drives does it have (non raid)
>  * does it have a raid controller
>  * how many hard drives are on the raid controller does it have
>  * how many optical drives, and what sorts
>  * how many floppy disk drives
>
> We run Debian and windows, so something that is cross platform is better.
>
> I've already found Sys::CPU, Sys::Hostname::FQDN. And I've found some
> modules that do network stuff, but they didn't give me what I needed, so
> I rolled my own, parsing ifconfig output.
>
> Perhaps someone has a more general answer? My goal is a YAML output
> hash, so I can integrate it with other stuff.
>
Hi Geoff,

You might stand a good chance of getting that sort of information from 
windows via the WMI interface.
Dave Roth has some examples such as 
http://www.roth.net/perl/scripts/scripts.asp?wmi-Generic.pl.
With linux you might be able to get results from /proc, but i wouldn't 
expect you would be able to use it
on bsd type machines (where /proc is usually unmounted) so unfortunately 
parsing ifconfig is probably the
"best" solution.

Best of luck
-Dave


More information about the Melbourne-pm mailing list