DiskSmartData class
- class diskinfo.DiskSmartData[source]
This class presents all collected SMART data for a disk. This class is created by
get_smart_data()
method. There are several disk type specific data attributes in this class, they are available only for a specific disk type(s).- find_smart_attribute_by_id(id_val)[source]
Finds a SMART attribute by the id and returns its index in
smart_attributes
list, or -1 if not found.- Parameters:
id_val (int) – SMART attribute id value
- Returns:
an index of the attribute in
smart_attributes
list, or -1 if not found- Return type:
Example
An example about the use of this function:
>>> from diskinfo import Disk, DiskSmartData >>> d = Disk("sda") >>> sd = d.get_smart_data(sudo=True) >>> sd.find_smart_attribute_by_id(5) 0
- find_smart_attribute_by_name(name_val)[source]
Finds an attribute by name and return with its index in
smart_attributes
list.- Parameters:
name_val (int) – SMART attribute name value
- Returns:
an index of the attribute in
smart_attributes
list, or -1 if not found- Return type:
Example
An example about the use of this function:
>>> from diskinfo import Disk, DiskSmartData >>> d = Disk("sda") >>> sd = d.get_smart_data(sudo=True) >>> sd.find_smart_attribute_by_name("Power_On_Hours") 1
- healthy: bool
The health status of the disk. Valid for all disk types. Meaning:
True: the disk is reported healthy (i.e. overall-health self-assessment test is PASSED).
False: the disk is reported failed (i.e. overall-health self-assessment test is FAILED).
- nvme_attributes: NvmeAttributes
NVME attributes for a disk. Valid only for NVME disks. See more details in
NvmeAttributes
class.
- smart_attributes: List[SmartAttribute]
List of the SMART attributes of a disk. Valid only for HDDs and SSDs, in case of NVME disk it will be empty. Methods
find_smart_attribute_by_id()
andfind_smart_attribute_by_name()
will find an item on this list based on an id or a name.