I decided to add database discovery to the MP. The attached MP is an expansion of my prior post.
Start by creating a database to hold information about the objects.
And fill it with some rows
Next create a new custom datasource
Note in particular that the Query used the OleDB module, and the ClassId and InstanceSettings used by the Mapper are passed as parameters. This allows you to reuse the datasource with lots of different discoveries where each discovery only has to know its database query, classtype, and the mapping between the two.
Next, create a class that we’ll discover with a database query.
Next, create a discovery using the datasource.
Here’s the XML for the Configuration:
<Configuration p1:noNamespaceSchemaLocation="C:\Documents and Settings\Administrator\Local Settings\Temp\DBMP.DiscoverMyClass.xsd" xmlns:p1="http://www.w3.org/2001/XMLSchema-instance">
Note the embedded SQL Query and mapping details.
I added a column to the MessageLog table called ItemID to act as a foreign key to the the ObjectTable table. I also added a rule to the attached MP targeting the discovered objects from the database, and monitoring the MessageLog table. So now the objects are described and stored in the database, and the health data about those objects also comes from the database. I’ve also posted the SQL code to create the database, but you’ll have to stick some data in it.
Please let me know if this is useful.