Agents stays non monitored for longer-Config Issue

Agents stays non monitored for longer. Status of RMS may be grayed out. And RMS is not recieving the new configuration file.

There could be stale data blocking the config for RMS

Any way, if you want to find out the stale data or the object which doesnt exist in console but are not groomed from database

Run the below query.

Warning: Make sure you have good backup of Opsmanager DB


DECLARE @BaseManagedEntityInternalId int
DECLARE @BaseManagedEntityId uniqueidentifier
DECLARE @ViewName sysname
DECLARE @Statement nvarchar(max)
SET @BaseManagedEntityInternalId = 0
WHILE EXISTS (SELECT * FROM BaseManagedEntity WHERE (BaseManagedEntityInternalId >
@BaseManagedEntityInternalId = bme.BaseManagedEntityInternalId
,@BaseManagedEntityId = bme.BaseManagedEntityId
,@ViewName = met.ManagedTypeViewName
FROM BaseManagedEntity bme
JOIN ManagedType met ON (bme.BaseManagedTypeId = met.ManagedTypeId)
WHERE (bme.BaseManagedEntityInternalId > @BaseManagedEntityInternalId)
AND (bme.IsDeleted = 0)
ORDER BY BaseManagedEntityInternalId
SELECT @Statement = 'IF NOT EXISTS (SELECT * FROM ' + QUOTENAME(@ViewName) + '
WHERE BaseManagedEntityId = ''' + CAST(@BaseManagedEntityId AS varchar(50)) + ''')
PRINT ''' + CAST(@BaseManagedEntityId AS varchar(50)) + ' ' + @ViewName + ''''


This may probably take a long time to run. So you need to be patient.

The output is all those objects that may be blocking config to be generated. You need to run the stored procedure to groom those object from database.