...making Linux just a little more fun!

### Get HW and SW inventary

ada * [adalex81 at gmail.com]
Wed, 22 Nov 2006 11:04:03 +0100

Hello everybody:

I'm a spanish girl in her last year at University studing computer engineering. I'm starting to look into linux to develope my end-degree project. The project deals with the managing of a heterogeneous net, this means that from a client (administrator) I have to get a Hardware and Software inventary of every computer and device in the net. The problem is that I just don't know where linux keeps such information (Windows keeps it in the register). Could any of you give a helping hand?

I mean to design the interface using J2EE tecnology, so I'll have to interrogate computers using java (neither how to do this yet).

Another question I'd like to ask is the best linux distribution to work with. I'll work with virtual machines so high requiriments do not represent huge problems.

hoping someone reads this (and spends sometime answering it ;) ), Galax

Top Back

Thomas Adam [thomas.adam22 at gmail.com]
Wed, 22 Nov 2006 14:45:24 +0000

Oh goody -- just my sort of question.

On Wed, 22 Nov 2006 11:04:03 +0100 "ada *" <adalex81@gmail.com> wrote:

    > Hello everybody:
    >
    > I'm a spanish girl in her last year at University studing computer
    > engineering.
    > I'm starting to look into linux to develope my end-degree project. The
    > project deals with the managing of a heterogeneous net, this means
    > that from a client (administrator)  I have to get a Hardware and
    > Software inventary of every computer and device in the net. The
    > problem is that I just donīt know where linux keeps such information
    > (Windows keeps it in the register). Could any of you give a helping
    > hand?

"A hardware and software inventory of every computer and device on the net". That isn't possible -- not even anywhere near so. The problem is that you're assuming there's a generic means to do so. There isn't. Basic network management will tell you many things about how to determine what computers are there. You ping your interface's broadcast address for that:

    ping -b XXX.XXX.XXX.XXX

(See the output from 'ifconfig' to ascertain it). You can do all manner of things to "count" them, if that's what you want.

As for software, this depends entirely on the distribution. You can't easily make any kind of guess for this, without knowing the OS, etc. Not all distros have package managers (BSD, etc). And then of course, what constitutes "all" software? What if some software hasn't been installed via the package manager, for instance? It's a rather silly and unquantifiable means, which seems to have no end.

Have you looked at Nagios?

    > I mean to design the interface using J2EE tecnology, so I'll have to
    > interrogate computers using java (neither how to do this yet).

J2EE is both boring, and complex. If you don't know how to do this at even the basic level using a three-tiered approach, you're screwed trying to even hack it, quite frankly.

    > Another question I'd like to ask is the best linux distribution to
    > work with. Iīll work with virtual machines so high requiriments do
    > not represent huge problems.

Any one will do. I use Debian. Again, what do you mean by "best"?

-- Thomas Adam

Top Back

Neil Youngman [ny at youngman.org.uk]
Wed, 22 Nov 2006 14:59:40 +0000

On or around Wednesday 22 November 2006 10:04, ada * reorganised a bunch of electrons to form the message:

    > Hello everybody:
    >
    > I'm a spanish girl in her last year at University studing computer
    > engineering.
    > I'm starting to look into linux to develope my end-degree project. The
    > project deals with the managing of a heterogeneous net, this means that
    > from a client (administrator)  I have to get a Hardware and Software
    > inventary of every computer and device in the net. The problem is that I
    > just donīt know where linux keeps such information (Windows keeps it in the
    > register). Could any of you give a helping hand?

On each machine there's information about most of the hardware in the /proc filesystem. I don't know exactly what's where. /proc/cpuinfo contains CPU info. /proc/ide contains info on ide devices, /proc/scis contains info on SCSI devices, etc. I'm sure Google can help you fill in most of the gaps.

For software, you can usually tell what's been installed via the package managers. Different distributions may use different package managers. The major distributions tend to use either APT or RPM. Again Google will be a great help in learning more about these.

Of course any software that has been installed in other ways (e.g. compiled from source) will be invisible to the package managers.

HTH

Neil Youngman

Top Back

Benjamin A. Okopnik [ben at linuxgazette.net]
Wed, 22 Nov 2006 11:33:04 -0500

On Wed, Nov 22, 2006 at 11:04:03AM +0100, ada * wrote:

    >
    >    Hello everybody:
    >
    >
    >
    >    I'm a spanish girl in her last year at University studing computer
    >    engineering.
    >
    >    I'm starting to look into linux to develope my end-degree project. The
    >    project deals with the managing of a heterogeneous net, this means that from
    >    a client (administrator)  I have to get a Hardware and Software inventary of
    >    every computer and device in the net. The problem is that I just donīt know
    >    where linux keeps such information (Windows keeps it in the register). Could
    >    any of you give a helping hand?

Linux keeps that information in the package database, which is much easier to query than the Wind0ws registry; however, there's a problem in both cases. If, for example, I have PuTTY on that Wind0ws machine, your registry search will never show it - since it creates no registry entries. There are a number of other Wind0ws programs that omit that step, too.

By the same token, any Linux programs that are installed without using the package database - e.g., tarballs or locally-written programs - are not "registered" and can't be enumerated. In anything other than tightly-controlled system with full accountability (e.g., a TCSEC B1-rated system), there's no way to determine a full "software inventory" - especially given the broad meaning that's assigned to the term "software".

    # Look at me, I'm creating software!
    echo -e '#!/bin/sh\necho "Hello, World"' > hello; chmod +x hello

    >    I mean to design the interface using J2EE tecnology, so I'll have to
    >    interrogate computers using java (neither how to do this yet).

One of the biggest mistakes you can make is to decide on the tools you're going to use before you've determined the scope of the problem you're trying to solve. If I was trying for a "best-fit" solution for the problem you've stated, I'd probably use Expect and SSH, in much the same way that I previously used them for my 'sshtool' script.

http://linuxgazette.net/100/lg_tips.html#tips.2

    >    Another question I'd like to ask is the best linux distribution to work
    >    with.

As the Japanese say, mu ("The question that you've asked includes assumptions that make it impossible to answer", or, more succinctly, "unask the question". It's like asking "what is the best type of hammer?" The answer really depends on what you're trying to do. For the above-stated task, there's really no difference; you can smash your thumb with any and every single distro with equal ease.

    --
    * Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *

Top Back

Lew Pitcher [lpitcher at sympatico.ca]
Wed, 22 Nov 2006 14:50:35 -0500

Benjamin A. Okopnik wrote:

    > On Wed, Nov 22, 2006 at 11:04:03AM +0100, ada * wrote:
    >
    >>   Hello everybody:
    >>
    >>
    >>
    >>   I'm a spanish girl in her last year at University studing computer
    >>   engineering.
    >>
    >>   I'm starting to look into linux to develope my end-degree project. The
    >>   project deals with the managing of a heterogeneous net, this means that from
    >>   a client (administrator)  I have to get a Hardware and Software inventary of
    >>   every computer and device in the net. The problem is that I just donīt know
    >>   where linux keeps such information (Windows keeps it in the register). Could
    >>   any of you give a helping hand?
    >
    >
    > Linux keeps that information in the package database, which is much
    > easier to query than the Wind0ws registry;

Funny, I don't find any such "package database" on a number of my Linux systems. Are you certain that this "package database" is inherent in Linux, or is it just an optional add-on that /some/ Linux installations may use.

For that matter, the content and format for the "package database" on two of my systems is completely different; my Ubuntu-based system uses a completely different storage system and package naming convention than my Slackware-based systems do. Are you certain that you don't mean /a/ package database, rather than /the/ package database?

    > however, there's a problem in
    > both cases. If, for example, I have PuTTY on that Wind0ws machine, your
    > registry search will never show it - since it creates no registry
    > entries. There are a number of other Wind0ws programs that omit that
    > step, too.
    >
    > By the same token, any Linux programs that are installed without using
    > the package database - e.g., tarballs or locally-written programs - are
    > not "registered" and can't be enumerated.

Hmmmm. I'll accept "not registered", but I disagree with "can't be enumerated". Certainly, a listing of the standard program directories could be considered an enumeration.

    > In anything other than tightly-controlled system with full
    > accountability (e.g., a TCSEC B1-rated system), there's no way to
    > determine a full "software inventory" - especially given the broad
    > meaning that's assigned to the term "software".

OK, this I will agree with

    > ``
    > # Look at me, I'm creating software!
    > echo -e '#!/bin/sh\necho "Hello, World"' > hello; chmod +x hello
    > ''
    >
    >
    >>   I mean to design the interface using J2EE tecnology, so I'll have to
    >>   interrogate computers using java (neither how to do this yet).
    >
    >
    > One of the biggest mistakes you can make is to decide on the tools
    > you're going to use before you've determined the scope of the problem
    > you're trying to solve.

Truer words have never been spoken.

    > If I was trying for a "best-fit" solution for
    > the problem you've stated, I'd probably use Expect and SSH, in much the
    > same way that I previously used them for my 'sshtool' script.
    >
    > http://linuxgazette.net/100/lg_tips.html#tips.2
    >
    >
    >>   Another question I'd like to ask is the best linux distribution to work
    >>   with.
    >
    >
    > As the Japanese say, mu ("The question that you've asked includes
    > assumptions that make it impossible to answer", or, more succinctly,
    > "unask the question".  It's like asking "what is the best type of
    > hammer?" The answer really depends on what you're trying to do. For the
    > above-stated task, there's really no difference; you can smash your
    > thumb with any and every single distro with equal ease.

I agree. A better definition of the problem is needed before any sort of guess at the solution can be provided.

Ada will have to answer such questions as

1) /Is/ there a complete repository of /all/ installed software (including shell scripts, perl scripts, etc.) available on each of her systems?

2) Is this repository queriable? Do the results make sense? Can results from different systems be compared?

3) /Is/ there a complete repository of all hardware installed on each system? Is this repository queriable, etc?

4) What sort of API can be used to query the hardware and software inventory mechanisms? Is there a common API? Are the results in a common form?

5) What sort of reporting will be necessary? What sort of details need to be reported? What reporting mechanism?

6) Can a common server implementation resolve the differences between systems?

7) How to install an inventory server on each affected system

8) How to query and consolidate the results from each server, so that the reporting requirements are satisfied.

    --
    Lew

Top Back

Thomas Adam [thomas.adam22 at gmail.com]
Wed, 22 Nov 2006 20:13:42 +0000

[ Re-added the querent, since you seemed to have dropped her from this discussion. :| ]

On Wed, Nov 22, 2006 at 02:50:35PM -0500, Lew Pitcher wrote:

    > Funny, I don't find any such "package database" on a number of my Linux
    > systems. Are you certain that this "package database" is inherent in Linux,
    > or is it just an optional add-on that /some/ Linux installations may use.

As I mentioned, there is no common format, and neither should there be. (c.f. registry).

    > For that matter, the content and format for the "package database" on two of
    > my systems is completely different; my Ubuntu-based system uses a completely
    > different storage system and package naming convention than my
    > Slackware-based systems do. Are you certain that you don't mean /a/ package
    > database, rather than /the/ package database?

Well, of course they're different. Slackware doesn't have a package management system per se. It completely depends upon the distro as to the underlying method used. Again, even if you could ascertain it being an RPM-based system, for example, that's no guarantee of anything, either. It's a complete waste of time, and a rather stupid exercise to even try and do.

    > Hmmmm. I'll accept "not registered", but I disagree with "can't be
    > enumerated". Certainly, a listing of the standard program directories could
    > be considered an enumeration.

Only on a limited scale. RPM systems are slightly better in this regard in that they associate files created by programs post-installation as being part of a package, whereas dpkg will not, and cannot associate arbotrary files created post-installation that weren't part of a package. The "enumeration" you refer to is only a heuristic to a much larger problem.

    > 1) /Is/ there a complete repository of /all/ installed software (including
    > shell scripts, perl scripts, etc.) available on each of her systems?

Even if all the computers were identical in terms of their OS -- the fact that they're going to all have different usages, with different ways of working is still no guarantee of the software on them.

    > 2) Is this repository queriable? Do the results make sense? Can results from
    > different systems be compared?

See above.

    > 3) /Is/ there a complete repository of all hardware installed on each
    > system? Is this repository queriable, etc?

Depends if it's Linux. Some of it will be available via /proc

    > 4) What sort of API can be used to query the hardware and software inventory
    > mechanisms? Is there a common API? Are the results in a common form?

See above.

    > 5) What sort of reporting will be necessary? What sort of details need to be
    > reported? What reporting mechanism?

That's secondary to even making sure the data can reliably be ascertained. Given it's likely to be J2EE there's various EJBs which allow for this.

    > 6) Can a common server implementation resolve the differences between systems?

Nope. Not without going through circular hoops.

-- Thomas Adam

    --
    "Wanting to feel; to know what is real.  Living is a lie." -- Purpoise
    Song, by The Monkees.

Top Back

Benjamin A. Okopnik [ben at linuxgazette.net]
Wed, 22 Nov 2006 22:01:24 -0500

[ Re-adding the querent to the CC. Lew, please respond to TAG and the querent in the future - thanks. ]

On Wed, Nov 22, 2006 at 02:50:35PM -0500, Lew Pitcher wrote:

    > Benjamin A. Okopnik wrote:
    > >
    > > Linux keeps that information in the package database, which is much
    > > easier to query than the Wind0ws registry;
    >
    > Funny, I don't find any such "package database" on a number of my Linux
    > systems. Are you certain that this "package database" is inherent in Linux,
    > or is it just an optional add-on that /some/ Linux installations may use.

I'm not clear on the precise argument that you have with my statement, Lew. Is it just semantic nitpicking because I used the word "the", or are you simply unfamiliar with the various types of package-tracking systems in the various distros?

Yes, it is possible to create a "distro" which does not keep track of what is installed - there's nothing to stop you from doing so, although I think the meaning of the word "distro" would be strained beyond its limits at that point. However, very few if any people would bother to use such a gadget - why would they want to? It would be like buying a car without seats when every other type of car comes with them preinstalled.

    > For that matter, the content and format for the "package database" on two of
    > my systems is completely different; my Ubuntu-based system uses a completely
    > different storage system and package naming convention than my
    > Slackware-based systems do. Are you certain that you don't mean /a/ package
    > database, rather than /the/ package database?

Do you have more than one on your system? I certainly don't, and I've never heard of any distro that does. I meant "the package database", and so I said "the package database".

As to the variety of querying tools... if I had a number of systems that I needed to poll, I'd install a script on them - named something like "query_all_packages" - that would run the appropriate tool. Conversely, I could write a script that would try the tools in succession and use whichever one was appropriate. That particular problem presents little to no difficulty.

    > > however, there's a problem in
    > > both cases. If, for example, I have PuTTY on that Wind0ws machine, your
    > > registry search will never show it - since it creates no registry
    > > entries. There are a number of other Wind0ws programs that omit that
    > > step, too.
    > >
    > > By the same token, any Linux programs that are installed without using
    > > the package database - e.g., tarballs or locally-written programs - are
    > > not "registered" and can't be enumerated.
    >
    > Hmmmm. I'll accept "not registered", but I disagree with "can't be
    > enumerated". Certainly, a listing of the standard program directories could
    > be considered an enumeration.

Your certainty is completely unwarranted - there are plenty of programs outside of the standard directories. My statement is accurate as originally made.

    > Ada will have to answer such questions as
    >
    > 1) /Is/ there a complete repository of /all/ installed software (including
    > shell scripts, perl scripts, etc.) available on each of her systems?

This is, indeed, the question to which my original statement was addressed. The answer in pretty much every case will be "no".

    > 2) Is this repository queriable? Do the results make sense? Can results from
    > different systems be compared?
    >
    > 3) /Is/ there a complete repository of all hardware installed on each
    > system? Is this repository queriable, etc?

As far as I know, only partial solutions - other than manual accounting, which is 180 degrees away from what Ada is trying to do - are available there, as well ('lspci', etc.)

    > 4) What sort of API can be used to query the hardware and software inventory
    > mechanisms? Is there a common API? Are the results in a common form?

ACPI is supposed to be(come) such an API. It is not, alas, quite ready for prime time yet.

    > 5) What sort of reporting will be necessary? What sort of details need to be
    > reported? What reporting mechanism?
    >
    > 6) Can a common server implementation resolve the differences between systems?

Only if users aren't allowed to touch the machines after installation.

    > 7) How to install an inventory server on each affected system
    >
    > 8) How to query and consolidate the results from each server, so that the
    > reporting requirements are satisfied.

In other words - and similar to my conclusion - the only results that can be extracted from a best-case attempt would be partial ones. In my opinion, the project is a bit too ambitious in its stated goals.

    --
    * Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *

Top Back

Ramon van Alteren [ramon at vanalteren.nl]
Thu, 23 Nov 2006 16:08:18 +0100

Hi Ada,

ada * wrote:

    > I'm a spanish girl in her last year at University studing computer
    > engineering.
    > I'm starting to look into linux to develope my end-degree project. The
    > project deals with the managing of a heterogeneous net, this means
    > that from a client (administrator)  I have to get a Hardware and
    > Software inventary of every computer and device in the net. The
    > problem is that I just donīt know where linux keeps such information
    > (Windows keeps it in the register). Could any of you give a helping hand?

We deal with this problem on a regular basis. I manage a large network of linux servers (300+) with different hardware and software. We using scripts and software to determine what is in and on our servers.

Linux keeps a large amount of detailed hardware information in both /proc and /sys The presence of the /sys part is dependent on kernel version, so you are not guaranteed to have that one present.

The easiest way to query for hardware info in such a network would be snmp. But due to the configurable nature of linux this may or may not be present on a server. The presence of a snmpd is a decision that is up to the individual system administrator.

The software part is much harder, there is no standard repository of installed software on windows or linux a.f.a.i.k. I remember to be able to install multiple software on windows without causing a change in the registry.

If you are from the J2EE world this will probably sound familiar to you ;-)

There is no standard way in linux to determine what software is installed. RPM-based systems (RedHat, Mandrake, SuSe and others) have a rpm database which holds all installed rpm-packages. This is absolutely no guarantee that there isn't any other software present.

Debian and derivates (f.e. Ubuntu) have a different package system that holds the same information, with the same guarantee of completeness.

The only advice I have to offer there is that you need to limit the scope of your research assignment to a defined way of installing software, or maybe to a class of software. It is fairly simple to query a server for active network software such as apache (webserver) or squid, dns etc.etc.

    > I mean to design the interface using J2EE tecnology, so I'll have to
    > interrogate computers using java (neither how to do this yet).

Take a good look at existing opensource software before you settle on something or start writing something from scratch. There are monitoring software packages out there that might help you, we're using nagios to monitor our servers, It's also capable of queying snmp. You might save yourself a lot of work by extending an existing package instead of recreating one from scratch. That is also a prime example of the beauty of open source and it's power, you actually can extend any opensource package.

I would be interested in the end-result of your reseach, will you post (a link to ) the results ?

    >
    > Another question I'd like to ask is the best linux distribution to
    > work with. Iīll work with virtual machines so high requiriments do not
    > represent huge problems.
    >
    > hoping someone reads this (and spends sometime answering it ;) ),

Pick any, it's probably more related to personal preference then capabilities. I hope this helps.

Good luck

Ramon

Top Back

ada * [adalex81 at gmail.com]
Fri, 24 Nov 2006 12:30:20 +0100

hi!!:

thank you all for your answers, everyone of them have been pretty useful. I feel there's one item i did not ask properly. It's the following:

"Another question I'd like to ask is the best linux distribution to work with. I'll work with virtual machines so high requiriments do not represent huge problems."

what I meant was that which distribution has the easiest way to access packages, or which has packages?

thanks again, Ada

Top Back

Thomas Adam [thomas.adam22 at gmail.com]
Fri, 24 Nov 2006 11:39:14 +0000

On Fri, 24 Nov 2006 12:30:20 +0100 "ada *" <adalex81@gmail.com> wrote:

    > what I meant was that which distribution has the easiest way to access
    > packages,  or which has packages?

You're still asking a meta-question -- which will inevitably give you a biased response. The answer is simple: none of them will, and all of them will, depending on which distribution you're *familiar* with.

Again, I use Debian. YMMV, as others will chime in with their $DISTRO of choice. To be honest, if you have to actually ask this question, I question whether or not your project is best suited to you. You gets some points of perseverance, but there is such a thing as scope...

-- Thomas Adam

Top Back

Thomas Adam [thomas.adam22 at gmail.com]
Fri, 24 Nov 2006 12:03:22 +0000

Begin forwarded message:

    Date: Fri, 24 Nov 2006 12:51:51 +0100
    From: "ada *" <adalex81@gmail.com>
    To: "Thomas Adam" <thomas.adam22@gmail.com>
    Subject: Re: [TAG] Get HW and SW inventary

hi: I have not used linux too much, so I'm familiar with none distribution, that's why I asked, but as usual I=B4ll learn as much as needed to suceed it, moreover I chose this project particulary because I was going to learn a lot. So I think I need a distro for begginers which has RPM package managing.

thank you, Ada

Top Back

Thomas Adam [thomas.adam22 at gmail.com]
Fri, 24 Nov 2006 12:18:31 +0000

[ Please retain the Cc to tag@lists.linuxgazette.net -- I am not offering consultancy. ]

On Fri, 24 Nov 2006 12:51:51 +0100 "ada *" <adalex81@gmail.com> wrote:

    > hi:
    > I have not used linux too much, so I'm familiar with none
    > distribution, that's why I asked, but as usual Iīll learn as much as
    > needed to suceed it, moreover I chose this project particulary
    > because I was going to learn a lot.
    > So I think I need a distro for begginers which has RPM package
    > managing.

SuSE, RedHat, Fedora ....

-- Thomas Adam

Top Back