Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
misc
exam.security
microsoft_update_catalog
msdn.annotations
msdn.drgui.discussion
msdn.duwamish
msdn.general
msdn.magazine
msdn.soaptoolkit
msdn.webservices
msdntraining
opsmgr.connectors
opsmgr.sp1
technet
technet.howtofeedback
technet.howtoneeds
technet.magazine
technet.technettalks
  
 
date: Mon, 21 Apr 2008 09:04:07 -0700,    group: microsoft.public.opsmgr.sp1        back       


how do you manually clean agent data in DB?   
We have a couple agents that will not show under Pending Agents after a 
manual install; these agents did exist in the DB for a very some time, but 
were disassociated and we are unsure how.  The Health Service and Health 
Service Watcher state views still show the agents, but we do not see them 
under the MT_Computer table or in the Agent Managed view.  We do see 
references to them in the BasedManagedEntity table.  

In a lab I have tried to manually clean up agents by running this cmdlet and 
it appears to have cleaned up some things, but I still cannot get an agent to 
show under pending with a manual install, also.. this only works if there is 
an entry in the MT_Computer table.

---------------------------------------------------------------------------------
$rootMS = 'scomsrv1'

#Initializing the Ops Mgr 2007 Powershell provider
     add-pssnapin "Microsoft.EnterpriseManagement.OperationsManager.Client" 
-ErrorVariable errSnapin ;
     set-location "OperationsManagerMonitoring::" -ErrorVariable errSnapin ;
     new-managementGroupConnection -ConnectionString:$rootMS -ErrorVariable 
errSnapin ;
     set-location $rootMS -ErrorVariable errSnapin ;

$agentnames= "exchfe.hyperlogical.local"

$administration = (get-item .).ManagementGroup.GetAdministration(); 

$agentManagedComputerType = 
[Microsoft.EnterpriseManagement.Administration.AgentManagedComputer]; 

$genericListType = [System.Collections.Generic.List``1] 
$genericList = $genericListType.MakeGenericType($agentManagedComputerType) 

$agentList = new-object $genericList.FullName 

$agent = Get-Agent | where {$_.PrincipalName -eq $agentNames} 

$agentList.Add($agent); 

$genericReadOnlyCollectionType = 
[System.Collections.ObjectModel.ReadOnlyCollection``1] 
$genericReadOnlyCollection = 
$genericReadOnlyCollectionType.MakeGenericType($agentManagedComputerType) 

$agentReadOnlyCollection = new-object $genericReadOnlyCollection.FullName 
@(,$agentList); 


$administration.DeleteAgentManagedComputers($agentReadOnlyCollection); 
---------------------------------------------------------------------------------

I've also tried running the stored procedures individually found in 
p_DataPurging to expedite things, but still no luck.  I've also set grooming 
to 1 day for everything.

I've also tried deleting the BasedManagedEntityID entries that reference the 
agent, working backwards to each table that has a Reference Constraint and 
removing the entries that would eventually allow me to remove it from the 
BasedManagedEntity table.

[In the following examples, I have changed machine names to protect identiy]

On the agent in the event log, all we see every 3 min is 21203 "OpsMgr has 
no configuration for management group.."

On the GW, we see the related event:

Event Type:	Information
Event Source:	OpsMgr Connector
Event Category:	None
Event ID:	20020
Date:		4/21/2008
Time:		9:49:07 AM
User:		N/A
Computer:	DC1
Description:
The health service {8B6B33D8-6DAD-EAC8-61D0-B9DF3DA76F02} running on host 
DC1.bogus.local and serving management group M3TG with id 
{CF29542E-73B4-2B3B-D118-81975D896E19} is available.

On the RMS we see a related event:

Event Type:	Warning
Event Source:	OpsMgr Config Service
Event Category:	None
Event ID:	29106
Date:		4/20/2008
Time:		7:16:58 PM
User:		N/A
Computer:	P10MOMRMS01
Description:
The request to synchronize state for OpsMgr Health Service identified by 
"3d49b419-6c68-cfb1-ff26-543d41f80082" failed due to the following exception 
"Microsoft.Mom.ConfigService.Public.ConfigServiceException: An instance was 
deleted before its properties could be read. ---> 
Microsoft.EnterpriseManagement.Common.DataItemDoesNotExistException: An 
instance was deleted before its properties could be read.
   at 
Microsoft.Mom.ConfigService.DataAccess.DatabaseAccessor.QueryInstanceProperties(ReadOnlyCollection`1 instances)
   at 
Microsoft.Mom.ConfigService.Engine.ConfigurationEngine.CommunicationHelper.StateSyncRequestTask.ConfigurationItems.Instances.CollectPublicProperties(ReadOnlyCollection`1 identities, IConfigurationDataAccessor dataAccessor)
   at 
Microsoft.Mom.ConfigService.Engine.ConfigurationEngine.CommunicationHelper.StateSyncRequestTask.ConfigurationItems.ConfigurationItemCollection`2.CollectPublicProperties(IConfigurationDataAccessor dataAccessor)
   at 
Microsoft.Mom.ConfigService.Engine.ConfigurationEngine.CommunicationHelper.StateSyncRequestTask.ConfigurationItems..ctor(StateContext 
stateContext, IConfigurationDataAccessor dataAccessor)
   --- End of inner exception stack trace ---
   at 
Microsoft.Mom.ConfigService.Engine.ConfigurationEngine.CommunicationHelper.StateSyncRequestTask.ConfigurationItems..ctor(StateContext 
stateContext, IConfigurationDataAccessor dataAccessor)
   at 
Microsoft.Mom.ConfigService.Engine.ConfigurationEngine.CommunicationHelper.StateSyncRequestTask.CreateResponse(Managers managers)
   at 
Microsoft.Mom.ConfigService.Engine.ConfigurationEngine.Managers.Synchronize(OnDoSynchronizedWork onDoSynchronizedWork)
   at 
Microsoft.Mom.ConfigService.Engine.ConfigurationEngine.CommunicationHelper.StateSyncRequestTask.Run(Guid 
source, String cookie, Managers managers, IConfigurationDataAccessor 
dataAccessor, Stream stream, IConnection connection)".




Again, this testing was done in a lab and we have not tried anything on the 
production side.  While I understand doing all the above it likely not 
supported, there must be a way to clean up an agent entirely either through a 
cmdlet or executing some of the stored procedures.  I am hoping something can 
be shared here from Marc or Jakub before I have to call PSS.

Thanks.. Jeff
date: Mon, 21 Apr 2008 09:04:07 -0700   author:   Jeff Bryant

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us