- Interact with Azure Cosmos DB with PowerShell - Tue, Sep 14 2021
- Azure health services: Track Microsoft cloud outages and maintenance - Wed, Sep 8 2021
- Powerline: Customize your PowerShell console - Tue, Aug 31 2021
The term "predictive analytics" gets a lot of tech press nowadays. According to Wikipedia, predictive analytics "encompasses a variety of statistical techniques… that analyze current and historical facts to make predictions about future or otherwise unknown events."
You may already use Reliability Monitor in Windows Server to view your server's historical stability concerning Windows and application failures as shown in the next figure.
But what about core performance-related data as accessed from Performance Monitor and the System Event Log? You may have spent significant time manually monitoring Perfmon and/or Event Viewer to find CPU, memory, storage, and network-related issues.
Who hasn't spent lots of time with these tools?
Perhaps you've even invested a lot of time creating PowerShell scripts that automate gathering Perfmon and Event Log data across one or multiple servers.
Well, today I'd like to introduce you to System Insights, a new Windows Server 2019 feature that uses predictive analytics to assess past server-usage trends to predict future consumption, plan for future hardware purchases, and ensure your server has sufficient resources to do its job. Let's get down to business!
Set up the environment ^
We can install the System Insights feature in a couple different ways. In Windows Server 2019, fire up an administrative PowerShell console and install the System Insights feature:
Install-WindowsFeature -Name System-Insights -IncludeManagementTools
System Insights is a PowerShell service, one thereby fully equipped for remote management. Let's see the SystemInsights module's enclosed commands:
Get-Command -Module SystemInsights |Select-Object -Property Name Name ---- Add-InsightsCapability Disable-InsightsCapability Disable-InsightsCapabilitySchedule Enable-InsightsCapability Enable-InsightsCapabilitySchedule Get-InsightsCapability Get-InsightsCapabilityAction Get-InsightsCapabilityResult Get-InsightsCapabilitySchedule Invoke-InsightsCapability Remove-InsightsCapability Remove-InsightsCapabilityAction Set-InsightsCapabilityAction Set-InsightsCapabilitySchedule Update-InsightsCapability
Another option is to install System Insights and register it as a Windows Admin Center extension. As you can see in the next screenshot, this option shows up in Windows Admin Center under Tools > System Insights.
Here is my setup on a brand-new Windows Server 2019 virtual machine:
Note that my capabilities status shows as None along with the message "Check back again later - we don't have enough recent data to make predictions." The bottom line is it will take a while (at least 24 hours) before System Insights can give you any analysis and feedback.
Once System Insights has predictions for you, each capability lists one of the following status IDs:
Invoking System Insights capabilities ^
As you can see in the previous screenshot, as of this writing in late December 2019, System Insights has four capabilities:
- CPU capacity forecasting
- Network capacity forecasting
- Total storage consumption forecasting
- Volume consumption forecasting
I have two key details you should know about System Insights:
- The predictive analytics engine System Insights uses works entirely locally, from data collection to persistence to analysis. In other words, the service does not "phone home" to the Microsoft Azure cloud.
- The network capacity and volume consumption capabilities work across multiple instances. Therefore, you will get feedback on multiple volumes and/or network interfaces on your servers.
To that second bullet point: Although System Insights does not access the cloud itself, you can indeed forward System Insights capability data to an Azure Log Analytics workspace if you want to.
You can invoke a capability run manually in Windows Admin Center by selecting the capability row and then clicking Invoke. Click Settings to schedule Windows Server to invoke a capability run; I show you the interface in the following screenshot.
Viewing predictions ^
Select any capability on the System Insights page to see the predictive analytics and forecasting results.
In the previous screenshot, we see that the server's CPU stats have been steady; System Insights forecasts that based on past metrics, future CPU usage will remain within available capacity.
Configuring automatic remediation ^
System Insights' actions enable you to run a custom PowerShell remediation script based on a capability's prediction result. This is a great feature because you can automate remediation; for instance, you can extend a disk volume automatically if space becomes too constrained.
In Windows Admin Center, browse to the server's Files tab and upload your PowerShell script. Alternatively, you can use a network share path. Next, navigate to the System Insights landing page, select a capability, click Settings, and switch to Actions as shown in the next screenshot.
Note that you can add a different script to respond automatically to Ok, Warning, Critical, or Error prediction conditions. Although the screenshot doesn't show it, you can also supply a separate set of credentials under whose authority the actions take place.
Invoke that capability to allow System Insights to use your newly defined custom action.
What do you think? In my opinion, System Insights' underlying PowerShell "engine" makes this a compelling role to add to your Windows Server 2019 systems. I also like the fact that all the machine-learning bits remain internal to the server.
Finally, according to Microsoft's System Insights FAQ, the role isn't resource intensive. To quote them:
Subscribe to 4sysops newsletter!
"Each default capability is inexpensive to run. Each capability will take longer to run as you collect more data, but they typically should complete in a just a few seconds."