Monitor Microsoft Storage Spaces Direct / Disk Status

For Monitoring the Virtual Disks, Storage Pools and Storage Jobs i’ve created a simple local Check:

Aswell if you want to have all physical disks from s2d in monitoring:

Only for size and status. Performance could be monitored by calling the Performance Counters.
If you are monitoring a s2d hyper-v cluster I would recommend to check aswell for the FailoverCluster Ressources: https://gist.github.com/hpmmatuska/bc94b9e087655391b251

Tho have the correct units in the graph’s you have to add a seperate metric file:
vi local/share/check_mk/web/plugins/metrics/check_storage_spaces.py

# -*- encoding: utf-8; py-indent-offset: 4 -*-
metric_info["allocatedsize"] = {
    "title": _("Allocated size"),
    "unit": "bytes",
    "color": "#FF0000",
}
metric_info["footprintonpool"] = {
    "title": _("Footprint on Pool"),
    "unit": "bytes",
    "color": "#FFFF00",
}
metric_info["size"] = {
    "title": _("Size"),
    "unit": "bytes",
    "color": "blue",
}```

Hi!

I have installed your check on my server, and it finds all disks and lists them in checkmk. To make sure it works, I connected a disk with SMART errors to a device and tested the script again, it still reports the disk to be fine.
I am managing linux servers too, and these use smartmontools which works fine. you can have smartmontools on windows x64 too, https://sourceforge.net/projects/smartmontools/ has a precompiled version.
My knowledge in powershell scripting is really small, is it possible to adopt the smart script from linux clients to windows and powershell? We would be able to see much more details about the disks.

Thank you for the scripts, they are a good starting point!

Hi,
I’ve made a small change to your code - on some windows boxes there are blanks within the serial field. This removes those artifactes:

Other than that - probe is nice and fits nicely into my just published smart probing script :slight_smile:

Best regards
Andreas

$pdisks = Get-PhysicalDisk | Where { $_.FriendlyName -ne “HP LOGICAL VOLUME” } | Select FriendlyName, SerialNumber, OperationalStatus, HealthStatus, Usage, Size,

AllocatedSize, VirtualDiskFootprint
foreach ($pdisk in $pdisks) {
if ($pdisk.OperationalStatus -eq “OK” -and $pdisk.HealthStatus -eq “Healthy”) {
# All good
$status = “0”
#Remove Whitespaces
$serial=$pdisk.SerialNumber.replace(’ ‘,’’)
$diskname = $pdisk.Friendlyname -replace ‘\s’,’’
$diskname = $pdisk.Friendlyname -replace ’ ‘,’’
$statusText = “OK - " + $diskname + " is in good state. OperationalStatus:” + $pdisk.OperationalStatus + " | HealthStatus:" + $pdisk.HealthStatus + " | Usage: " +

$pdisk.Usage + " | Size:" + $pdisk.Size + " | SN:" + $serial
} else {
$status = “1”
$statusText = “Warning - " + $diskname + " is in unusual state. OperationalStatus:” + $pdisk.OperationalStatus + " | HealthStatus:" + $pdisk.HealthStatus + " |

Usage: " + $pdisk.Usage + " | Size:" + $pdisk.Size + " | SN:" + $serial
}
$perfdataVirtualDisk = “size=” + $pdisk.Size + “|allocatedsize=” + $pdisk.AllocatedSize + “|virtualdiskfootprint=” + $pdisk.VirtualDiskFootprint
$stringToPost = $status + " S2D_PhysicalDisk_" + $serial + " " + $perfdataVirtualDisk + " " + $statusText
Write-Host $stringToPost
}

Good idea, i’ve added this aswell in my code.

@Stich
I’m not 100% sure, but I guess when in an S2D Environment the additional smartmonitor won’t work. The Get-Physicaldisk cmdlet should report disk issues when appearing - but i’m not sure if they are watching the smart counters the same as traditional tools.
For example: In Server 2019 they detect disk issues by comparing the disk latency against other disks from the same type of the server.

Hi!

I found out that the powershell version without smartmontools is not working the hard way, because we had a failing disk in a multi disk raid system, smart reported pending sectors but powershell reported no errors.
I don’t want to wait until the disk is totally gone, I want to swap and recover on the first sign of upcoming trouble.

To test this, I got a disk with SMART errors just for testing in my machine, and powershell thinks it is fine…

andreas wrote a mkp package with some more additional stuff: https://github.com/Yogibaer75/Check_MK-Things/tree/master/checks/hyperv_cluster

1 Like