Probe to scan S.M.A.R.T. Status on Windows Systems

Hi all,

did some research on how to get similar results when using the local plugin “smart” on linux systems under Windows. Wasn’t able to find a script. So I’ve created a PowerShell (my first one :slight_smile: , so please excuse ugly or non-optimal code) script.
Testing and adopting still ongoing, but at least for a standard dedicated windows server it delivers the information required and integrates immediately within Check-mk doing an inventory.
Would be happy to get some feedback.
BTW - PowerShell has got some really nice features, especially the JSON management impresses me.
Requires Smartmontools being installed.

Code is being maintained on github, planning to deliver a package some time.

Best regards
Andreas

3 Likes

Hello,

I was searching for this a lot. Does your script works for SSD wear indication as well?
If not I’m working on the script that will cover all possibilities, but in vbs. If u care to share your knowlege contact me so we could make something for the community :smiley:

Hi,

in the end the input for the script is the output of smartctl. If smartctl is delivering the SSD wear information, it could be parsed.
Haven’t worked on the script for a while, as most of my windows servers are now virtualized, so the disk monitoring is done on another point.
But - in the end - is a good idea to do this on the ESX level as well.

The value you are looking for is 177 - Wear_Leveling_Count
If your SSD is delivering the value, it will be visible by my script:

In this case - it is just a cheap one - the smart command isn’t providing wear_level_count.

Please test on your system:

a) get a list of all disks attached —> smartctl --scan
b) get the current values —> smartctl -a -d /dev/sda (if this is a name in your list)

If you can see here the wear level, all is good. If not - it is not provided by the SSD.

SMART Attributes Data Structure revision number: 4
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
5 Reallocated_Sector_Ct 0x0032 100 100 — Old_age Always - 0
9 Power_On_Hours 0x0032 253 100 — Old_age Always - 21682
12 Power_Cycle_Count 0x0032 100 100 — Old_age Always - 148
166 Min_W/E_Cycle 0x0032 100 100 — Old_age Always - 1
167 Min_Bad_Block/Die 0x0032 100 100 — Old_age Always - 36
168 Maximum_Erase_Cycle 0x0032 100 100 — Old_age Always - 481
169 Total_Bad_Block 0x0032 100 100 — Old_age Always - 256
171 Program_Fail_Count 0x0032 100 100 — Old_age Always - 0
172 Erase_Fail_Count 0x0032 100 100 — Old_age Always - 0
173 Avg_Write/Erase_Count 0x0032 100 100 — Old_age Always - 352
174 Unexpect_Power_Loss_Ct 0x0032 100 100 — Old_age Always - 102
187 Reported_Uncorrect 0x0032 100 100 — Old_age Always - 0
194 Temperature_Celsius 0x0022 066 153 — Old_age Always - 34 (0 153 0 22 0)
212 SATA_PHY_Error 0x0032 100 100 — Old_age Always - 0
230 Perc_Write/Erase_Count 0x0032 100 100 — Old_age Always - 0 0 2889
232 Perc_Avail_Resrvd_Space 0x0033 100 100 004 Pre-fail Always - 100
233 Total_NAND_Writes_GiB 0x0032 100 100 — Old_age Always - 45699
241 Total_Writes_GiB 0x0030 253 253 — Old_age Offline - 18834
242 Total_Reads_GiB 0x0030 253 253 — Old_age Offline - 1963
243 Unknown_Attribute 0x0032 100 100 — Old_age Always - 0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
No self-tests have been logged. [To run self-tests, use: smartctl -t]

Selective Self-tests/Logging not supported

PS C:\Users\Administrator> .\smart.ps1
<<>>
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 5 Reallocated_Sector_Ct 0x0032 100 100 Old-age Always - 0
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 9 Power_On_Hours 0x0032 253 100 Old-age Always - 21682
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 12 Power_Cycle_Count 0x0032 100 100 Old-age Always - 148
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 166 Min_W/E_Cycle 0x0032 100 100 Old-age Always - 1
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 167 Min_Bad_Block/Die 0x0032 100 100 Old-age Always - 36
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 168 Maximum_Erase_Cycle 0x0032 100 100 Old-age Always - 481
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 169 Total_Bad_Block 0x0032 100 100 Old-age Always - 256
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 171 Program_Fail_Count 0x0032 100 100 Old-age Always - 0
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 172 Erase_Fail_Count 0x0032 100 100 Old-age Always - 0
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 173 Avg_Write/Erase_Count 0x0032 100 100 Old-age Always - 352
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 174 Unexpect_Power_Loss_Ct 0x0032 100 100 Old-age Always - 102
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 187 Reported_Uncorrect 0x0032 100 100 Old-age Always - 0
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 194 Temperature_Celsius 0x0022 66 153 Old-age Always - 34 (0 153 0 22 0)
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 212 SATA_PHY_Error 0x0032 100 100 Old-age Always - 0
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 230 Perc_Write/Erase_Count 0x0032 100 100 Old-age Always - 0 0 2889
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 232 Perc_Avail_Resrvd_Space 0x0033 100 100 4 Pre-fail Always - 100
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 233 Total_NAND_Writes_GiB 0x0032 100 100 Old-age Always - 45699
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 241 Total_Writes_GiB 0x0030 253 253 Old-age Always - 18834
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 242 Total_Reads_GiB 0x0030 253 253 Old-age Always - 1963
SanDiskSD6SF1M128G1022I153993400028 ATA SanDiskSD6SF1M128G1022I 243 Unknown_Attribute 0x0032 100 100 Old-age Always - 0

I have tested the script and everything seems to be working. I just need to check reporting for nvme. I read something about nvme.cli but only for some nvme’s. Your sccript is what I was looking for in a week now. Thanks a lot!
Best regards,