truenas / py-SMART

Wrapper for smartctl (smartmontools)
GNU Lesser General Public License v2.1
76 stars 35 forks source link

Attributes of NVMe device are None #79

Closed juniorh closed 8 months ago

juniorh commented 8 months ago

Describe the bug I'm writing a script to monitor S.M.A.R.T of NVMe disk. I'm using KYO Kaizen NVMe M.2 PCIe and pysmart unable to detect S.M.A.R.T result

Raw outputs Please, provide the following raw command outputs to be added to our test-base. Notify explicitly if you don't want them to be incorporated. In any case, they are "mostly required" to check and verify your issue/bug.

>>> DeviceList()
<DeviceList contents:
<NVME device on /dev/nvme0 mod:KZ256 sn:AA000000000000000972>
>

>>> DeviceList()[0]
<NVME device on /dev/nvme0 mod:KZ256 sn:AA000000000000000972>

>>> DeviceList()[0].attributes
[None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None]

>>> DeviceList()[0].all_attributes()
This device does not support SMART attributes.

>>> DeviceList()[0].diags
{'Reallocated_Sector_Ct': '-', 'Start_Stop_Spec': '-', 'Start_Stop_Cycles': '-', 'Start_Stop_Pct_Left': '-', 'Load_Cycle_Spec': '-', 'Load_Cycle_Count': '-', 'Load_Cycle_Pct_Left': '-', 'Power_On_Hours': '-', 'Life_Left': '-', 'Corrected_Reads': '-', 'Corrected_Writes': '-', 'Corrected_Verifies': '-', 'Uncorrected_Reads': '-', 'Uncorrected_Writes': '-', 'Uncorrected_Verifies': '-', 'Reads_GB': '-', 'Writes_GB': '-', 'Verifies_GB': '-', 'Reads_count': '-', 'Writes_count': '-', 'Verifies_count': '-', 'block_size': '512', 'Non-Medium_Errors': '-'}
/dev/nvme0 -d nvme # /dev/nvme0, NVMe device

=== START OF INFORMATION SECTION === Model Number: KZ256 Serial Number: AA000000000000000972 Firmware Version: V0721A0 PCI Vendor/Subsystem ID: 0x126f IEEE OUI Identifier: 0x000000 Controller ID: 1 NVMe Version: 1.3 Number of Namespaces: 1 Namespace 1 Size/Capacity: 256,060,514,304 [256 GB] Namespace 1 Formatted LBA Size: 512 Local Time is: Mon Jan 22 15:52:16 2024 WIB Firmware Updates (0x12): 1 Slot, no Reset required Optional Admin Commands (0x0017): Security Format Frmw_DL Self_Test Optional NVM Commands (0x0015): Comp DS_Mngmt Sav/Sel_Feat Log Page Attributes (0x03): S/H_per_NS Cmd_Eff_Lg Maximum Data Transfer Size: 64 Pages Warning Comp. Temp. Threshold: 83 Celsius Critical Comp. Temp. Threshold: 85 Celsius

Supported Power States St Op Max Active Idle RL RT WL WT Ent_Lat Ex_Lat 0 + 6.00W - - 0 0 0 0 15000 0

Supported LBA Sizes (NSID 0x1) Id Fmt Data Metadt Rel_Perf 0 + 512 0 0

=== START OF SMART DATA SECTION === SMART overall-health self-assessment test result: PASSED

SMART/Health Information (NVMe Log 0x02) Critical Warning: 0x00 Temperature: 40 Celsius Available Spare: 100% Available Spare Threshold: 10% Percentage Used: 0% Data Units Read: 156,468 [80.1 GB] Data Units Written: 199,219 [102 GB] Host Read Commands: 3,011,614 Host Write Commands: 439,883 Controller Busy Time: 12 Power Cycles: 8 Power On Hours: 8 Unsafe Shutdowns: 5 Media and Data Integrity Errors: 0 Error Information Log Entries: 0 Warning Comp. Temperature Time: 0 Critical Comp. Temperature Time: 0

Error Information (NVMe Log 0x01, 16 of 64 entries) No Errors Logged



**Environmental setup:**
 - Complete smartctl version: smartctl 7.3 2022-02-28 r5338 [aarch64-linux-5.10.110-rockchip-rk3588] (local build)
 - Py-SMART version: pysmart-1.3.0
 - OS Debian 12
 - Hardware: Orange Pi 5

**Additional context**
None
ralequi commented 8 months ago

Hi @juniorh

First of all, my apologies for the confusion.

The "attributes" attribute of the object, as comments describe only applies for ATA disks, nor scsi/sas or Nvmes.

You should check for if_attributes instead https://github.com/truenas/py-SMART/blob/faea21ded68759fad8cf36f270ba77d4362e3f33/pySMART/device.py#L246

It would have an object of this type: https://github.com/truenas/py-SMART/blob/faea21ded68759fad8cf36f270ba77d4362e3f33/pySMART/interface/nvme/__init__.py#L501-L526

Hope I have helped.

Feel free to ask any other question you have and close this issue if I have resolved your doubts.

juniorh commented 8 months ago

Hi @ralequi

Thanks for explanation. I'm closing this issue