Skip to main content

SmartDevice

Struct SmartDevice 

Source
pub struct SmartDevice {
Show 17 fields pub device: String, pub protocol: String, pub model: String, pub passed: Option<bool>, pub temperature_c: Option<f32>, pub power_on_hours: Option<u64>, pub percentage_used: Option<u32>, pub available_spare_percent: Option<u32>, pub available_spare_threshold_percent: Option<u32>, pub critical_warning: Option<u32>, pub media_errors: Option<u64>, pub reallocated_sectors: Option<u64>, pub pending_sectors: Option<u64>, pub offline_uncorrectable: Option<u64>, pub data_written_bytes: Option<u64>, pub collected_at_ms: Option<u64>, pub error: Option<String>,
}
Expand description

SMART health of one drive, parsed from smartctl -j -a output.

Fields a drive or protocol does not report are None (NVMe drives have no sector reallocation counters, ATA drives no “percentage used”).

Fields§

§device: String

Kernel device name ("nvme0", "sda"). See device_matches_disk.

§protocol: String

Protocol reported by smartctl ("NVMe", "ATA", "SCSI").

§model: String

Drive model.

§passed: Option<bool>

Overall health self-assessment; None if smartctl could not tell.

§temperature_c: Option<f32>

Current drive temperature.

§power_on_hours: Option<u64>

Accumulated power-on time.

§percentage_used: Option<u32>

NVMe wear estimate (may exceed 100).

§available_spare_percent: Option<u32>

NVMe spare capacity left.

§available_spare_threshold_percent: Option<u32>

NVMe spare threshold below which the drive reports a warning.

§critical_warning: Option<u32>

NVMe critical warning bit field (0 when healthy).

§media_errors: Option<u64>

NVMe unrecovered data integrity errors.

§reallocated_sectors: Option<u64>

ATA attribute 5 (Reallocated_Sector_Ct), raw value.

§pending_sectors: Option<u64>

ATA attribute 197 (Current_Pending_Sector), raw value.

§offline_uncorrectable: Option<u64>

ATA attribute 198 (Offline_Uncorrectable), raw value.

§data_written_bytes: Option<u64>

Total host writes, where the drive reports them.

§collected_at_ms: Option<u64>

When smartctl ran, in milliseconds since the Unix epoch. Lets front-ends flag stale results (e.g. the timer stopped running).

§error: Option<String>

Error reported by smartctl (e.g. the device could not be opened).

Implementations§

Source§

impl SmartDevice

Source

pub fn needs_attention(&self) -> bool

Returns true if anything in the SMART data calls for attention.

Trait Implementations§

Source§

impl Clone for SmartDevice

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SmartDevice

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SmartDevice

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for SmartDevice

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for SmartDevice

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.