I'm trying to monitor the health of our Storage Spaces Direct virtual disks using PowerShell with XML/Custom Advanced senor, with something like this:

$GVD = Get-VirtualDisk  | Where-Object HealthStatus -ne Healthy
Write-Host "<prtg>"
Write-Host "<result>" 
"<channel>Get-VirtualDisk</channel>"
"<value>"+ $GVD.FriendlyName +"</value>" 
"</result>"

I basically want to be alerted when one (ideally it should output which, using FriendlyName) virtual disk is not Healthy.

What I have runs, but the value is always 0 and I can't make it to work.


Article Comments