在 Windows Admin Center 中管理 System Insights 功能

可以管理和配置 System Insights 功能以满足部署需求。 This article explains how to adjust settings for each capability using PowerShell or Windows Admin Center, with step-by-step examples and screenshots.

View capabilities

You can list all of the available capabilities using the Get-InsightsCapability cmdlet:

  1. Open PowerShell. 输入以下命令:
Get-InsightsCapability

在 PowerShell 中使用 Get-InsightsCapability cmdlet 的屏幕截图。

启用和禁用功能

可以启用或禁用每一项功能。 禁用某项功能会阻止调用该功能,对于非默认功能,禁用某项功能会停止该功能的所有数据收集。 默认情况下,所有功能都已启用,可以在更改功能之前检查功能的状态。

To enable a capability, use the Enable-InsightsCapability cmdlet:

  1. 打开 PowerShell,然后输入以下命令,将功能的名称替换为所选的功能。

    Enable-InsightsCapability -Name "CPU capacity forecasting"
    

To disable a capability, use the Disable-InsightsCapability cmdlet:

  1. 打开 PowerShell,然后输入以下命令,将功能的名称替换为所选的功能。

    Disable-InsightsCapability -Name "Networking capacity forecasting"
    
  2. 系统会提示你确认你正在禁用的功能。

    在 PowerShell 中使用 Disable-InsightsCapability cmdlet 的屏幕截图。

调用功能

Invoking a capability immediately runs the capability to retrieve a prediction, and administrators can invoke a capability any time in Windows Admin Center, or by using the Invoke-InsightsCapability cmdlet. 为确保调用某项功能不会与计算机上的关键操作发生冲突,请考虑在非工作时间计划预测。

  1. 打开 PowerShell,然后输入以下命令,将功能的名称替换为所选的功能。

    Invoke-InsightsCapability -Name "CPU capacity forecasting"
    
  2. 确认要调用该功能。

    在 PowerShell 中使用 Invoke-InsightsCapability cmdlet 的屏幕截图。

检索功能结果

Once a capability is invoked, the most recent results are visible using Get-InsightsCapability or Get-InsightsCapabilityResult. These cmdlets output the most recent Status and Status Description of each capability, which describe the result of each prediction. The Status and Status Description fields are further described in the understanding capabilities document.

Additionally, you can use the Get-InsightsCapabilityResult cmdlet to view the last 30 prediction results and to retrieve the data associated with the prediction:

# Specify the History parameter to see the last 30 prediction results.
Get-InsightsCapabilityResult -Name "CPU capacity forecasting" -History

# Use the Output field to locate and then show the results of "CPU capacity forecasting."
# Specify the encoding as UTF8, so that Get-Content correctly parses non-English characters.
$Output = Get-Content (Get-InsightsCapabilityResult -Name "CPU capacity forecasting").Output -Encoding UTF8 | ConvertFrom-Json
$Output.ForecastingResults

使用事件日志检索功能结果

每次功能完成预测时,系统见解都会记录一个事件。 These events are visible in the Microsoft-Windows-System-Insights/Admin channel, and System Insights publishes a different event ID for each status:

Prediction status Event ID
Ok 151
Warning 148
Critical 150
Error 149
None 132

Use Azure Monitor or System Center Operations Manager to aggregate these events and see prediction results across a group of machines.

设置能力计划

除了按需预测之外,还可以为每项功能配置定期预测,以便按照预定义的计划自动调用指定的功能。 每项默认功能都计划在每天凌晨 3 点运行。 但是,可以为每个功能创建自定义计划,System Insights 支持各种计划类型。

Use the Get-InsightsCapabilitySchedule cmdlet to see capability schedules. Use the pipeline | in PowerShell to see information for all capabilities returned by the Get-InsightsCapability cmdlet.

Get-InsightsCapability | Get-InsightsCapabilitySchedule

Periodic predictions are enabled by default though they can be disabled at any time using the Enable-InsightsCapabilitySchedule and Disable-InsightsCapabilitySchedule cmdlets:

Enable-InsightsCapabilitySchedule -Name "Total storage consumption forecasting"
Disable-InsightsCapabilitySchedule -Name "Volume consumption forecasting"

You can create custom schedules for each capability using the Set-InsightsCapabilitySchedule cmdlet:

Set-InsightsCapabilitySchedule -Name "CPU capacity forecasting" -Daily -DaysInterval 2 -At 4:00PM
Set-InsightsCapabilitySchedule -Name "Networking capacity forecasting" -Daily -DaysOfWeek Saturday, Sunday -At 2:30AM
Set-InsightsCapabilitySchedule -Name "Total storage consumption forecasting" -Hourly -HoursInterval 2 -DaysOfWeek Monday, Wednesday, Friday
Set-InsightsCapabilitySchedule -Name "Volume consumption forecasting" -Minute -MinutesInterval 30

由于默认功能会分析每日数据,因此建议对这些功能使用每日计划。 Learn more about the default capabilities.

创建补救措施

利用系统见解,你可以根据功能的结果启动自定义修正脚本。 对于每项功能,你都可以为每个预测状态配置自定义 PowerShell 脚本,从而使管理员能够自动执行修正操作,而不需要手动干预。

示例修正操作包括运行磁盘清理、扩展卷、运行重复数据删除、实时迁移 VM 和设置 Azure 文件同步。

You can see the actions for each capability using the Get-InsightsCapabilityAction cmdlet:

Get-InsightsCapability | Get-InsightsCapabilityAction

You can create new actions or delete existing actions using the Set-InsightsCapabilityAction and Remove-InsightsCapabilityAction cmdlets. Each action is run using credentials that are specified in the ActionCredential parameter.

$Cred = Get-Credential
Set-InsightsCapabilityAction -Name "CPU capacity forecasting" -Type Warning -Action "C:\Users\Public\WarningScript.ps1" -ActionCredential $Cred
Set-InsightsCapabilityAction -Name "CPU capacity forecasting" -Type Critical -Action "C:\Users\Public\CriticalScript.ps1" -ActionCredential $Cred

Remove-InsightsCapabilityAction -Name "CPU capacity forecasting" -Type Warning

若要详细了解系统见解,请使用以下资源: