Hi elmuziko,
the script itself works still fine but you have to trust to the SMART values ESXi is reading. And I found out that these values aren't reliable when read by ESXi!
I use enterprise storage disks from WD and here ESXi doesn't read the values right. The values of some important SMART parameters are 200 if your disk is OK, i. e. Reallocated_Sector_Ct. But ESXi reads 0. If the disk is OK the value is greater than the threshold which is at 140. Because of reading the value as 0 you get an error message. You see warnings in the syslog of ESXi
2022-04-04T17:58:55.592Z smartd[526738]: [warn] t10.ATA_____WDC_WD3000F9YZ2D09N20L1_______________________WD2DWCC13DRRJZJP: REALLOCATED SECTOR CT below threshold (0 < 140)
2022-04-04T17:58:55.680Z smartd[526738]: [warn] t10.ATA_____WDC_WD3000F9YZ2D09N20L1_______________________WD2DWCC136FZX9CU: REALLOCATED SECTOR CT below threshold (0 < 140)
2022-04-04T17:58:55.927Z smartd[526738]: [warn] t10.ATA_____WDC_WD3000F9YZ2D09N20L1_______________________WD2DWCC130NF3EEZ: REALLOCATED SECTOR CT below threshold (0 < 140)
2022-04-04T17:58:56.016Z smartd[526738]: [warn] t10.ATA_____WDC_WD3000F9YZ2D09N20L1_______________________WD2DWMC130E1ZMKA: REALLOCATED SECTOR CT below threshold (0 < 140)
and my script always sends an error notification. So I bought new disks believing that they are getting old and can cause disk errors and data corruption in the near future which isn't the case . By the way, the new WD disks are seen as faulty by ESXi, too.
When reading the SMART values of these disks under Windows with CrystalDiskInfo or under ESXi with smartmontools - there's an ESXi version of an older version - the correct value 200 is read.
And then I found out that this issue seems to happen with all WD disks, i. e. WD Red etc. I saw a lot of examples with this issue. With disks from other manufactorer the values are read by ESXi right.
WD doesn't see an issue regarding using the disks with VMware ESXi and getting wrong SMART values. They won't help to solve the issue.
Now I try to get a solution for reading the SMART values by using the smartmontools and getting error notifications when there are really errors.
Kind Regards