Each configurationÂ object in the Service Manager CMDB has a discovery source, or multipleÂ discovery sources. This list contains all connectors or sources that have updated the object during its lifecycle. For example if we synchronize an active directory user object to the CMDB the AD connector is the first discovery source. If we later update the object with another connector or manually, that connector will be discovery source two for the object. If we update the object manually it is register as SDKDefaultConnector discovery source. When there is no discovery source left, the object will be deleted from the CMDB. In some scenarios you need to find out which discovery objects a object have. In this example I have an account named John Connor. If IÂ use a Active Directory connector to synchronize the account over to the Service Manager CMDB I get the following information in the CMDB.
If I add another AD connector, that also synchronize this John Connor account, I can see in the database that the account now I have discovery sources
If I now delete the first AD connector, field.local, and run the query again, we see that the John Connor accounts now have only one discovery source, the “Accounts OU” Active Directory connector.
If I now delete the second AD connector too, and run the SQL query, I see that the object now is deleted as there is no longer any discovery source. All incidents where John Connor was affected user now have a blank affected user field. If I create a new Active Directory connector, Account OU v2, I can see that the account is back in the CMDB and the new connector is discovery source. For the incident that John had before, the affected user field is still blank. Even if we synchronize the same account into the CMDB, it is not mapped together with the incident again
If I update the user object manually, for example adding the Office attribute, I can see an update in the database from the SDKDefaultConnector
If I now delete the Active Directory connector, the user object will not be deleted, as the manually modification of the object is a discovery source, and Service Manager will not delete an object with discovery sources.
If I modify a user in the Service Manager console, and then delete the modification again, for example letâ€™s say I add department, then I remove it again in the service manager console, the user will still have the
SDKDefaultConnector as discovery source. Â The result would be that even if I delete the Active Directory connector, the user will not be deleted as there is a discovery source left for the object. Therefor it could be a good idea to update the object in the data source, in this example in Active Directory.
This is the query I use to get discovery source of a object. Replace John Connor with any displayname
SELECTÂ Â Â Â DS.ConnectorId, BaseManagedEntity.DisplayName AS [Connector DisplayName], BaseManagedEntity_1.DisplayName AS [Object DisplayName]
FROMÂ Â Â Â Â Â Â Â DiscoverySource AS DS INNER JOIN
DiscoverySourceToTypedManagedEntity AS DSME ON DSME.DiscoverySourceId = DS.DiscoverySourceId INNER JOIN
Connector ON DS.DiscoverySourceId = Connector.ConnectorId INNER JOIN
BaseManagedEntity ON Connector.BaseManagedEntityId = BaseManagedEntity.BaseManagedEntityId INNER JOIN
BaseManagedEntity AS BaseManagedEntity_1 ON DSME.TypedManagedEntityId = BaseManagedEntity_1.BaseManagedEntityId
WHEREÂ Â Â Â (BaseManagedEntity_1.DisplayName = N’John Connor’)