Monitor Storage Spaces Direct Health with PowerShell #S2D #WS2016 #PowerShell


In Windows Server 2016, Microsoft added a new type of storage called Storage Spaces Direct (S2D). S2D enables building a highly available storage systems with local attached disks, and without the need to have any external SAS fabric such as shared JBODs or enclosures. With S2D, we can deploy two models: The converged model (known as disaggregated) where the storage is separated from the hypervisor running on different hardware, and the Hyper-Converged Infrastructure model (known as HCI) where the storage and the hypervisor (Hyper-V) running on the same hardware. This feature is included only in Windows Server 2016 Datacenter edition. You can find a lot of articles about S2D on my website.

Storage is the most critical component in any infrastructure, and with S2D it is even more critical since the availability can also affect virtual machines and applications. It’s crucial to monitor S2D in a proactive way to ensure it’s availability before any service gets affected.

Microsoft has written a management pack for Operations Manager which get information from S2D health service API on a regular basis. If you want to know more about how to monitor Storage Spaces Direct with System Center 2016 Operations Manager (SCOM), I advise you to check a great guide written by my fellow MVP Romain Serre.

In the near future, you will also be able to monitor Storage Spaces Direct with Microsoft Project Honolulu.

But what if you don’t have System Center 2016 Operations Manager license?

Project Honolulu is not even ready to manage Storage Spaces Direct based on Windows Server 2016 Version 1607.

Well, in this post, I’ll show you how to monitor S2D with Windows PowerShell, and if something goes wrong you will receive an e-mail alert.

Storage Spaces Direct Health Service

When you enable Storage Spaces Direct, a new cluster role is also enabled by default, known as the Health Service.

The health service cluster role gathers metrics and alerts of all the cluster nodes and provide them using an Application Programming Interface (API). This API can be accessible from PowerShell, and .Net. However, the Health Service is not usable for day-to-day administration because it provides real time metrics and no historical. Moreover there is no GUI built-in for monitoring.

As an example, if you want to gather the metrics by the Health Service, you can run Get-StorageHealthReport as shown in the next screenshot. This will give you a consolidated information about the memory available, the IOPS, the capacity, the average CPU usage and so on.

You can also check what is the last action performed on the system by running the Get-StorageHealthAction as shown below:

And the most important cmdlet is Debug-StorageSubsystem which will give you a complete overview about the current alerts in your S2D cluster as shown below. As you can see, the Health Service automatically detected that one of the node has a disconnected network cable. And since I have a redundant network path, the severity is Minor.

This is all great but not enough to monitor my S2D cluster on day-to-day basis. I want to receive an email alert as soon as something goes wrong in order to rectify the issue in a proactive way.

Storage Spaces Direct Health Monitoring

I was working lately on a PowerShell script that will keep checking my Storage Spaces Direct health, and then send me an email alert for any minor or critical issue that might arise on the cluster. This will help me to avoid keep checking manually the health service, because I have zillion other tasks to do.

Here is an automated email generated for Minor issue. One physical disk is damaged, you can see all the details including what action you need to take.

Here is another alert for Critical and Minor issue. One server is down and the network cable is disconnected.

You can run the tool once or you can automate the invocation by using a Scheduled Task to run every hour or so, and then send you an alert if something goes wrong. To do this, you can use the Register-ScheduleJob cmdlet.

Here’s an example to monitor your S2D Infrastructure every one hour:

The script above will run as the specified user (you will be prompted for credentials), and it is set to be elevated to use the highest privileges. In addition, the task will run every 60 minutes or however long you specified in $repeat variable.

Where can I download this tool

This monitoring tool is available on my GitHub repository. You can download the documentation and the script from here.


I am planning to improve this monitoring tool in the future. This is still version 1.1. If you have any feedback or changes that everyone should receive, please feel free to update the source and create a pull request.

Happy monitoring and Happy holidays!


About Charbel Nemnom 334 Articles
Charbel Nemnom is a Microsoft Cloud Consultant and Technical Evangelist, totally fan of the latest's IT platform solutions, accomplished hands-on technical professional with over 15 years of broad IT Infrastructure experience serving on and guiding technical teams to optimize performance of mission-critical enterprise systems. Excellent communicator adept at identifying business needs and bridging the gap between functional groups and technology to foster targeted and innovative IT project development. Well respected by peers through demonstrating passion for technology and performance improvement. Extensive practical knowledge of complex systems builds, network design and virtualization.

Be the first to comment