本文可帮助你修复 Operations Manager 代理处于 挂起管理 状态的问题。
原始产品版本: Microsoft System Center 2012 Operations Manager
原始 KB 数: 2626752
症状
在 System Center Operations Manager 命令行界面中,你可能会看到仍处于挂起管理状态的代理,即使它们未显示在 Operations Manager 控制台中的“挂起管理”下。
原因
如果在 Operations Manager 数据库中留下了代理记录,则可能会出现此问题。 在某些时候,这些代理手动部署到管理服务器,但后来该管理服务器已解除授权,并且代理从未正确删除。
解决方法
可执行以下步骤来解决此问题。
在此示例中,我们假设有两个名为 Agent1.contoso.msft 和 Agent2.contoso.msft 的代理系统。 这两个代理都分配给不再存在的名为 ManagementServer.Contoso.msft 的管理服务器。 在你的环境中,你将替换特定代理和管理服务器的名称。
AgentName:Agent1.contoso.msft
ManagementServerName:ManagementServer.Contoso.msft
AgentPendingActionType:PushInstallFailed
LastModified: <日期/时间>
ManagementGroup:Opsmgr-Group
ManagementGroupId:888a2cd4-0db6-f669-32f8-5b08aa25d2e2
AgentName:Agent2.contoso.msft
ManagementServerName:ManagementServer.Contoso.msft
AgentPendingActionType:PushInstallFailed
LastModified: <日期/时间>
ManagementGroup:Opsmgr-Group
ManagementGroupId:888a2cd4-0db6-f669-32f8-5b08aa25d2e2
注意
在对 Operations Manager 数据库执行任何查询之前,请确保存在完整和当前的备份。
运行以下查询:
SELECT AgentPendingActionId FROM AgentPendingAction WHERE AgentName like 'Agent1.contoso.msft'
结果:
2A5C2E8F-2AD4-1703-D3BE-4755DF1A8E2E
SELECT AgentPendingActionId FROM AgentPendingAction WHERE AgentName like 'Agent2.contoso.msft'
结果:
360DB30E-3C2C-50A9-B047-A123A87280C0
执行以下查询:
DECLARE @ActionId uniqueidentifier SET @ActionId = (SELECT AgentPendingActionId FROM AgentPendingAction WHERE AgentName like 'Agent1.contoso.msft') EXEC p_AgentPendingActionDeleteByIdList @AgentPendingActionIdList = @ActionId
已成功删除记录。 对第二个代理也执行相同的操作。
现在,通过 PowerShell,我们可以确认这两个系统不存在任何记录。
以下 PowerShell 命令显示每个代理及其分配的主服务器和故障转移管理服务器。
get-agent|ft -a ComputerName,primarymanagementservername,@{l="secondary";e={$_.getfailovermanagementservers()|foreach{$_.name }} }