在 System Center Operations Manager 中,当对操作控制台或代理问题进行故障排除时,你可能会看到“清除缓存”的建议。有关排查代理问题的详细信息,请参阅 “未监视”和“灰色代理”。
操作控制台
清除操作控制台缓存的一个可能原因是修复了访问视图中数据(例如 ObjectNotFoundExceptions)时发生的错误。 另一个原因是,当缓存文件太大时释放磁盘空间。
这可能需要从管理员 PowerShell 控制台执行,具体取决于组织策略。
# Option 1: This will read the console install directory from registry and then execute. Useful if installed in a non-default directory
Start-Process ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\System Center Operations Manager\12\Setup\Console").InstallDirectory + "Microsoft.EnterpriseManagement.Monitoring.Console.exe") -ArgumentList "/clearCache"
# Option 2: This will start the process in the default ProgramFiles directory
Start-Process "$Env:ProgramFiles\Microsoft System Center\Operations Manager\Console\Microsoft.EnterpriseManagement.Monitoring.Console.exe" -ArgumentList "/clearCache"
这可能需要根据组织策略从管理员命令提示符执行。
"%ProgramFiles%\Microsoft System Center\Operations Manager\Console\Microsoft.EnterpriseManagement.Monitoring.Console.exe" /clearcache
- 关闭任何打开的 Operations Manager 控制台。
- 删除控制台缓存文件:
%LocalAppData%\Microsoft\Microsoft.EnterpriseManagement.Monitoring.Console\momcache.mdb
- 重新打开 Operations Manager 控制台。
管理服务器
故障排除的最后一个步骤是清除缓存。 这将移除任何未保存的数据,以及当前配置和管理包。 清除缓存后,我们将从数据库收到包括更新管理包的新配置,并重新连接到客户端。 如果管理服务器中的管理包出现故障或缺失,导致工作流出错或向数据库发送数据时出现延迟,则此操作有帮助。
- 在监视工作区中,展开“Operations Manager”,然后展开“管理服务器”。
- 选择“ 管理服务器状态”。
- 在 “管理服务器状态 ”列中,选择一个或多个服务器。
- 在任务窗格中,选择刷新运行状况服务状态和缓存。
- 在提示窗口中,输入用于此任务的凭据,或使用默认值并点击“运行”
注意
请注意,此任务的工作方式与代理不同,因为管理服务器上在 HealthService 下运行的所有工作流(可能有数万个)都需要停止,这可能需要时间,以至于任务可能会超时或引发错误。 如果发生这种情况,您可能需要考虑手动清除缓存。
这可能需要根据组织策略从管理员控制台执行。
PowerShell:
# This will read the install directory from registry and perform the same steps outlined
Stop-Service HealthService -Force -Verbose;
Remove-Item -Path "$((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\System Center Operations Manager\12\Setup\Server").InstallDirectory + 'Health Service State')" -Recurse -Force;
Start-Service HealthService -Verbose
命令提示符(作为批处理文件):
:: Clear Health Service State (Cache)
ECHO OFF
net stop HealthService
FOR /F "usebackq tokens=2,* skip=2" %%L IN (`reg query "HKLM\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\Setup" /v InstallDirectory`) DO SET installpath=%%M
echo %installpath%
@RMDIR "%installpath%Health Service State" /S /Q
net start HealthService
网关服务器
故障排除的最后一个步骤是清除缓存。 有时,网关可能无法与管理服务器通信,并且在 System Center Operations Manager 控制台中显示为灰色。 在这种情况下,我们需要清除网关的缓存。 当网关具有过时或不可用的管理包或无法插入到数据库中的数据时,我们还需要执行此操作。
- 在监视工作区中,展开“Operations Manager”,然后展开“管理服务器”。
- 选择“ 管理服务器状态”。
- 在 “网关管理服务器状态 ”列中,选择一个或多个服务器。
- 在任务窗格中,选择刷新运行状况服务状态和缓存。
- 在提示窗口中,输入用于此任务的凭据,或使用默认值并点击“运行”
这可能需要根据组织策略从管理员控制台执行。
PowerShell:
# This will read the install directory from registry and perform the same steps outlined
Stop-Service HealthService -Force -Verbose;
Remove-Item -Path "$((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\System Center Operations Manager\12\Setup\Gateway").InstallDirectory + 'Health Service State')" -Recurse -Force;
Start-Service HealthService -Verbose
命令提示符(作为批处理文件):
:: Clear Health Service State (Cache)
ECHO OFF
net stop HealthService
FOR /F "usebackq tokens=2,* skip=2" %%L IN (`reg query "HKLM\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\Setup" /v InstallDirectory`) DO SET installpath=%%M
echo %installpath%
@RMDIR "%installpath%Health Service State" /S /Q
net start HealthService
客户服务器
修复客户端服务器上代理与管理组之间的工作流或通信问题的可能方法是清除缓存并重启代理。 这是进行故障排除的最后手段,但它可以有效地解决一些问题。
- 在监视工作区中,展开操作管理器,然后展开代理详细信息。
- 选择代理运行状况状态。
- 在 “代理状态 ”列中,选择一个或多个代理。
- 在任务窗格中,选择刷新运行状况服务状态和缓存。
- 在提示窗口中,输入用于此任务的凭据,或使用默认值并点击“运行”
注意
由于此操作会删除运行状况服务存储文件中的缓存数据,包括此任务本身的记录,因此在任务完成后,控制台中不会报告真正的任务状态,只要发送命令,它始终会“成功”。
这可能需要根据组织策略从管理员控制台执行。
PowerShell:
# This will read the install directory from registry and perform the same steps outlined
Stop-Service HealthService -Force -Verbose;
Remove-Item -Path "$((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\System Center Operations Manager\12\Setup\Agent").InstallDirectory + 'Health Service State')" -Recurse -Force;
Start-Service HealthService -Verbose
命令提示符(作为批处理文件):
:: Clear Health Service State (Cache)
ECHO OFF
net stop HealthService
FOR /F "usebackq tokens=2,* skip=2" %%L IN (`reg query "HKLM\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\Setup" /v InstallDirectory`) DO SET installpath=%%M
echo %installpath%
@RMDIR "%installpath%Health Service State" /S /Q
net start HealthService
后续步骤