Поделиться через


Where did that Config Item come from?

If you’ve setup several connectors in Service Manager, you’ll have a CMDB full of lovely configuration items.  Sometimes you may need to figure out which connectors brought in a Configuration Item.  Maybe there’s something in the CMDB which makes you think “huh, where did that come from?”

For example, if you’re considering deleting an old AD Connector, you may want to check a Windows Computer, to see whether it will be removed.  So, how do we tell which connectors created that computer?

 

Step 1 – Find the object:

In this example, let’s say we’re looking for a Computer, with a hostname of SM1

Open up SQL Management Studio & open a new query against your ServiceManager database.

Put in the following SQL query, replacing sm1 with the computer name you’re looking for.

 Select BaseManagedEntityId, FullName from 
 BaseManagedEntity where FullName like '%sm1%'

For a Windows Computer, I'll want the Microsoft.Windows.Computer object:

 

When you've found the Config Item you want, make a note of the BaseManagedEntityId.

 

Step 2 – Find the Connector:

 

Now we can look up which connectors created the object. 

Paste your BaseManagedEntityId into the query below, over the GUID at the end:

 Select c.ConnectorId, bme.DisplayName from Connector c 
 Join BaseManagedEntity bme
 on c.BaseManagedEntityId = bme.BaseManagedEntityId
 Where ConnectorId in (
 select ds.ConnectorId from TypedManagedEntity tme 
 join DiscoverySourceToTypedManagedEntity dse
 on tme.TypedManagedEntityId = dse.TypedManagedEntityId
 join DiscoverySource ds
 on ds.DiscoverySourceId = dse.DiscoverySourceId
 left outer join Discovery d 
 on d.DiscoveryId = ds.DiscoveryRuleId
 where tme.TypedManagedEntityId = 'FA0796D6-6A06-DB55-49E4-2C269D6A2C42')

We can now see in the results, that the computer SM1 was imported into the CMDB by the ‘Contoso AD Connector’.

You could use the same steps to locate a User in the CMDB too.  In step 1, just put in a username, and note the System.Domain.User object.