Creating an inventory collector

This topic describes how to register and implement your own inventory collector.

Subtopics

Related topics

Related sample code

The role of the collector

During its discovery procedure, an agent sends back a list of available service node names (registered subagents). The server maintains a separate list of these subagents for each discovered agent and looks for a match from this list of names with registered collectors on the server. When a match is found, the appropriate registered collector is invoked. It is this collector that makes calls to the agent for any inventory information. It is also the responsibility of the particular collector to populate the database with the received information, because it is the only collector that can be expected to know the exact format of the data from the agent.

Registering the collector

In order to tell the server about the new collector, you need to register it with the inventory service. A collector is essentially a normal IBM Director extension, with a registration step and a few overloaded functions that the inventory service will call. A sample of the registration code is here: SampleInventoryCollectorExtension.java

Implementing the collector

Once the collector has been registered, a couple of things need to be done. As a first step, you need to create a subagent that has the exact service node name that your extension registered with the inventory service. To see a sample subagent that matches with our sample collector, look at the java source for The sample inventory subagent. The subagent should receive commands that the registered collector will send for the inventory information. The second step is the actual implementation of the collector. This involves extending the Sample inventory collector. The implementation of the abstract class calls the actual driving mechanism of the collector that resides in the session class. Not only does the session class drive the queries to the agent, it also populates the database.

Debugging

Writing a inventory collector is not difficult, but there are many places where things can go wrong. It is difficult to test a collector as a standalone module. One way to generate copious lines about the state of your collector is to run RasWatch with the argument -high -inventory on the server. See the section on Troubleshooting for more information on the debugging facilities of IBM Director .